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