Re: Out of memory error

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Eelke Klein <eelke(at)bolt(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Out of memory error
Date: 2012-12-10 16:02:47
Message-ID: 20261.1355155367@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Eelke Klein <eelke(at)bolt(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin French 2012-12-10 16:04:28 Re: Problem with aborting entire transactions on error
Previous Message Thomas Kellerer 2012-12-10 16:02:37 Re: Problem with aborting entire transactions on error