Re: out of memory woes - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: out of memory woes
Date
Msg-id 20061220143329.GF30769@alvh.no-ip.org
Whole thread Raw
In response to Re: out of memory woes  ("Angva" <angvaw@gmail.com>)
List pgsql-general
Angva wrote:
> We found that the kernel setting SHMALL was set ridiculously high -
> 1024g!. Someone noticed this when running "ipcs -lm" - seemed just a
> tad off. :)

That's not a problem because it's just a limit.  It won't cause out of
memory or anything.

The problem with work_mem is that the system may request that much
memory for every Sort step.  Each query may have more than one of those,
and each backend can be serving more than one query at a time.  So those
200000 you have quickly turn into the gigabytes and consume the whole of
your RAM.

If a Sort step requires more than work_mem for its work, it will go to
disk -- but in a much faster way than what the kernel is able to do with
swap.  So whenever you are trading work_mem for swap, you are losing big
time.  You should decrease that figure.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: "Christian Maier"
Date:
Subject: plperl trigger problem
Next
From: Tom Lane
Date:
Subject: Re: plperl trigger problem