Murat Tasan <mmuurr(at)gmail(dot)com> writes:
> p.s. on the 8.4 version EXPLAIN ANALYZE *still* tells me that an
> external merge on disk is happening, despite my setting of work_mem to
> a full 16 MB this time.
When we have to push sort data to disk, it's written in a form that's
noticeably more compact than what's used in-memory. So it can be
expected that an in-memory sort will need significantly more memory
than what an external merge reports using on-disk. I'd try cranking
up work_mem to at least 10X the on-disk size if you want to be sure
of seeing an in-memory sort.
However, so far as I can see the sort is taking much less time than
the scan and join steps anyway, so you're not likely to get much
improvement this way. The unstable performance is a result of caching
effects for the table data, not of how the sort is done.
regards, tom lane
In response to
pgsql-performance by date
|Next:||From: Maciek Sakrejda||Date: 2012-06-01 15:38:10|
|Subject: Re: Trouble with plan statistics for behaviour for query.|
|Previous:||From: Tom Lane||Date: 2012-06-01 13:47:53|
|Subject: Re: Select from sequence in slow query log |