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 00:08:40
Message-ID: 802AEC6E-027E-4746-97B3-90C5FC4D33F9@trillitech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On May 15, 2010, at 4:51 PM, Tom Lane wrote:

> Tom Duffey <tduffey(at)trillitech(dot)com> writes:
>> I have a table with several hundred million rows of timestamped
>> values. Using pg_dump we are able to dump the entire table to disk
>> no
>> problem. However, I would like to retrieve a large subset of data
>> from this table using something like:
>
>> COPY (SELECT * FROM history WHERE timestamp > '2009-01-01') TO
>> STDOUT;
>
>> Executing this query causes our server to consume all available swap
>> and crash.
>
> What's being done on the client side with the data? AFAIK that
> operation really shouldn't consume a lot of memory on the server side.
> It would help if you'd be more specific about which process is
> consuming
> swap space.

I am executing the query in psql at the command line and piping the
result to a file, e.g.,

psql < get_data.sql > data.sql

Tom

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-05-16 00:28:41 Re: Query memory usage
Previous Message gaime igner 2010-05-15 23:29:52 How to Insert Async