Re: Sort memory not being released

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: jim(at)nasby(dot)net
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Sort memory not being released
Date: 2003-06-17 21:38:36
Message-ID: 15659.1055885916@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Jim C. Nasby" <jim(at)nasby(dot)net> writes:
> Of course I wasn't planning on sucking down a bunch of memory and
> holding on to it. :)

Sure. But when you're done with the big sort, just start a fresh
session. I don't see that this is worth agonizing over.

> If sort_mem is over X size, then use only Y for pre-buffering (How much
> does a large sort_mem help if you have to spill to disk?)

It still helps quite a lot, because the average initial run length is
(if I recall Knuth correctly) twice the working buffer size. I can't
see a reason for cutting back usage once you've been forced to start
spilling.

The bigger problem with your discussion is the assumption that we can
find out "if the OS is running low on free physical memory". That seems
(a) unportable and (b) a moving target.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joseph Shraibman 2003-06-17 22:12:26 Re: order of nested loop
Previous Message Jim C. Nasby 2003-06-17 21:31:34 Re: order of nested loop