Re: killed select? - Mailing list pgsql-general

From Tom Lane
Subject Re: killed select?
Date
Msg-id 14991.1014932901@sss.pgh.pa.us
Whole thread Raw
In response to killed select?  (jtp <john@akadine.com>)
List pgsql-general
jtp <john@akadine.com> writes:
> A question was asked which i through to the database to see how it was
> able to handle the question at hand and it failed . . . after 50 minutes
> of processing it flopped to the ground killed: out of swap space.

My guess is that what actually bombed out was psql, which tries to
buffer the entire result of a query.  (Well, actually it's libpq not
psql that does that, but anyway the client side is what's failing.)

I suspect that your query is insufficiently constrained and will return
many millions of rows --- are you sure you have the WHERE clauses right?

If you actually do need to process a query that returns gazillions of
rows, the best bet is to declare a cursor so you can fetch the result
in bite-size chunks, say a few hundred rows at a time.

            regards, tom lane

pgsql-general by date:

Previous
From: Andrew Sullivan
Date:
Subject: vsnprintf and 64-bit Solaris 7 (was: abnormal exits)
Next
From: Richard Emberson
Date:
Subject: bulk insertions in PL/pgsql functions