Re: out of memory for query result

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Sven Willenberger <sven(at)dmv(dot)com>
Cc: Douglas McNaught <doug(at)mcnaught(dot)org>, PostgreSQL general <pgsql-general(at)postgresql(dot)org>, Francisco Reyes <lists(at)stringsutils(dot)com>
Subject: Re: out of memory for query result
Date: 2006-05-03 19:12:39
Message-ID: 20060503191239.GE27354@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, May 03, 2006 at 02:52:57PM -0400, Sven Willenberger wrote:
> Using identical data and identical queries, why would the amd64 system
> using postgresql 8.1.3 be using some 2/3s more memory to store the query
> results before output than the i386 system using postgresql 8.0.4?

Is the amd64 system running 64-bit code? If so, the all the pointers
would double in size. That together with additional alignment
requirements could explain it.

> These are the final stages after the file has flushed (this was run on
> the prior month's data which had fewer results). This would either point
> to an issue with a) amd64 memory allocation or b) palloc interacting
> with 64bit memory or c) some other change.

psql doesn't use palloc. palloc exists purely in the backend.

> For now I will try the cursor technique; I assume that if this is run
> from within a function returning setof xxxx that I will run into the
> same issue?

The memory usage is purely the client trying to store the entire
dataset in memory. If your function is using the output but not
storing, there is ofcourse no problem.

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christo Romberg 2006-05-03 19:14:51 Connection error, help..please
Previous Message Guy Rouillier 2006-05-03 19:09:25 Re: How does an application recognize the death of the postmaster