Murat Tasan <mmu...@gmail.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

-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance

Reply via email to