Re: Out of memory error - Mailing list pgsql-general

From Tom Lane
Subject Re: Out of memory error
Date
Msg-id 20261.1355155367@sss.pgh.pa.us
Whole thread Raw
In response to Out of memory error  (Eelke Klein <eelke@bolt.nl>)
List pgsql-general
Eelke Klein <eelke@bolt.nl> writes:
> In a database of one of our customers we sometimes get out of memory
> errors. Below I have copy pasted one of these very long messages.
> The error doesn't always occur, when I copy paste the query and run it
> manually it works.

The memory map doesn't look out of the ordinary in the slightest.  The
only usage that amounts to anything worth noticing is

>           HashBatchContext: 19128368 total in 13 blocks; 747952 free (5 chunks); 18380416 used

but that seems quite legitimate considering you have work_mem set to 32MB.
So I don't see that Postgres is doing anything wrong or unusual here.
It seems the machine actually is running out of memory.

> Memory parameters are:
> shared_buffers = 4GB
> temp_buffers = 32MB
> work_mem = 32MB
> maintenance_work_mem = 256MB

That shared_buffers setting seems a bit excessive for a machine with
only 8GB RAM.  Do you also have swap disabled on this box?  If so, the
OS only has 4GB to play in for all processes and disk cache combined,
so it wouldn't be too hard to envision it running out of space.  Perhaps
watching the machine's overall RAM situation with "top" or another tool
would give more insight.

            regards, tom lane


pgsql-general by date:

Previous
From: Thomas Kellerer
Date:
Subject: Re: Problem with aborting entire transactions on error
Next
From: Martin French
Date:
Subject: Re: Problem with aborting entire transactions on error