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

From Angva
Subject Re: out of memory woes
Date
Msg-id 1166628315.373662.284680@48g2000cwx.googlegroups.com
Whole thread Raw
In response to Re: out of memory woes  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Alvaro Herrera wrote:
> That's not a problem because it's just a limit.  It won't cause out of
> memory or anything.

Ah, I see. Well, it's nice to have caught that anyway, I suppose.

> 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.

Thanks for that bit of advice, Alvaro. I did not know that a work_mem
is allocated for each sort step. I will try lowering work_mem gradually
until it impacts performance.

Though even if this fixes my problem, I'm still bothered by swap never
being used. (Not that I expect you to come up with a magic answer for
me.)

Thank you,
Mark


pgsql-general by date:

Previous
From: "Raymond O'Donnell"
Date:
Subject: Re: Merry Christmas!
Next
From: "Angva"
Date:
Subject: Re: out of memory woes