Re: Out of Memory errors while running pg_dump

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Erik Jones <erik(at)myemma(dot)com>
Cc: pgsql mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Out of Memory errors while running pg_dump
Date: 2008-02-04 22:47:43
Message-ID: 9878.1202165263@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Erik Jones <erik(at)myemma(dot)com> writes:
> On Feb 4, 2008, at 3:26 PM, Tom Lane wrote:
>> Are you sure the postmaster is being launched
>> under ulimit unlimited?

> ulimit -a gives:

One possible gotcha is that ulimit in an interactive shell isn't
necessarily the same environment that an init script will see;
you might want to temporarily put it into the init script, or
if you have plperlu or another untrusted language installed,
you could try system("ulimit -a >/tmp/foo") to check what the
backend is really seeing. But assuming that that's not it...

>> If it's a 32-bit machine, maybe you need to
>> back off shared_buffers or other shmem size parameters so that more
>> address space is left for backend private memory.

> It is a 32-bit machine and we're currently set @ 2GB for
> shared_buffers. For the others: 512 max_connections, 512
> max_locks_per_transaction and 0 max_prepared_transactions. While
> having both of those two 512s may seem large, much less and I get Out
> of Memory errors that specifically suggest increasing
> max_lock.s_per_transaction

Yeah, because pg_dump will need a lock for each table it's touching,
so you need a lot of lock table slots. But the fact that you're using
half the address space for shared buffers explains why it's tanking not
too far past the 1Gb point for local memory. I'd suggest backing that
off to 1Gb or less of shared_buffers to give yourself breathing room
for a large relcache. Given the amount of RAM in the machine, I doubt
you'll lose much in performance --- the disk blocks that might have been
in shared buffers will live in OS disk buffers instead, which is not
that much more expensive to access.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message mikie 2008-02-04 23:04:29 encoding does not match server's locale
Previous Message Erik Jones 2008-02-04 22:11:51 Re: Out of Memory errors while running pg_dump