Re: Query memory usage

From: Tom Duffey <tduffey(at)trillitech(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Query memory usage
Date: 2010-05-16 01:05:16
Message-ID: 911E621A-0474-421F-9CD1-C17F1AB3DB31@trillitech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On May 15, 2010, at 8:00 PM, Tom Lane wrote:

> Tom Duffey <tduffey(at)trillitech(dot)com> writes:
>> On May 15, 2010, at 7:28 PM, Tom Lane wrote:
>>> Well, I tried executing a large "copy (select ...)" query and
>>> couldn't
>>> see any memory bloat at all in either the backend or psql. So
>>> there's
>>> something relevant that you haven't told us.
>
>> I hope you are right! The actual query is different because I was
>> not
>> aware until right before I posted this question that you can have a
>> WHERE clause with COPY. Here is the actual query I ran:
>
>> SELECT point_id || E'\t' || status || E'\t' || value || E'\t' ||
>> timestamp
>> FROM point_history
>> WHERE timestamp > NOW() - interval '18 months';
>
> Ermm ... is that the whole query, or did you wrap it in COPY (...) TO
> STDOUT? The former case will cause psql to eat memory, because it
> tries
> to buffer the whole result of an ordinary query. In the latter case
> psql will just stream the data through to the output file.

That's the whole query. If I understand your reply correctly it
sounds like psql was the culprit and that I should try again using
COPY (...) TO STDOUT, no?

Tom

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2010-05-16 05:20:28 Re: Bizarre problem: Python stored procedure using protocol buffers not working
Previous Message Tom Lane 2010-05-16 01:00:39 Re: Query memory usage