Re: Tuning Question sort_mem vs pgsql_tmp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Tuning Question sort_mem vs pgsql_tmp
Date: 2003-02-04 17:24:49
Message-ID: 15245.1044379489@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Greg Stark <gsstark(at)mit(dot)edu> writes:
> Does sort_mem have to be larger than the corresponding pgsql_tmp area that
> would be used if postgres runs out of sort_mem?

Probably. At least in recent versions, the "do we still fit in
sort_mem" logic tries to account for palloc overhead and alignment
padding, neither of which are present in the on-disk representation
of the same tuples. So data unloaded to disk should be more compact
than it was in memory. You didn't say what you were sorting, but
if it's narrow rows (like maybe just an int or two) the overhead
could easily be more than the actual data size.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kris Jurka 2003-02-04 17:41:25 Re: 7.2.1: coalesce double-calls function?
Previous Message Greg Stark 2003-02-04 16:43:27 Tuning Question sort_mem vs pgsql_tmp