Re: Releasing memory during External sorting?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-performance(at)postgresql(dot)org
Subject: Re: Releasing memory during External sorting?
Date: 2005-09-23 14:09:39
Message-ID: 3465.1127484579@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Simon Riggs <simon(at)2ndquadrant(dot)com> writes:
> If not, I would propose that when we move from qsort to tapesort mode we
> free the larger work_mem setting (if one exists) and allocate only a
> lower, though still optimal setting for the tapesort. That way the
> memory can be freed for use by other users or the OS while the tapesort
> proceeds (which is usually quite a while...).

On most platforms it's quite unlikely that any memory would actually get
released back to the OS before transaction end, because the memory
blocks belonging to the tuplesort context will be intermixed with blocks
belonging to other contexts. So I think this is pretty pointless.
(If you can't afford to have the sort using all of sort_mem, you've set
sort_mem too large, anyway.)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-09-23 14:16:01 Re: pgxs and pginstaller
Previous Message Tom Lane 2005-09-23 13:57:05 Re: What has happened to pgxs?

Browse pgsql-performance by date

  From Date Subject
Next Message Bruno Wolff III 2005-09-23 14:20:27 Re: VACUUM FULL vs CLUSTER
Previous Message Arjen van der Meijden 2005-09-23 14:06:54 Re: How to determine cause of performance problem?