Re: [HACKERS] \dt and disk access - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: [HACKERS] \dt and disk access
Date
Msg-id eb5008348a67f46ac71ef5af2d932b26
Whole thread Raw
In response to [HACKERS] \dt and disk access  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
Bruce Momjian wrote:
> It looks like psort()'s use of disk files to do the sorting is causing
> the slowdown, with the multiple create's and unlink's.  I am going to
> modify psort() to use memory buffers instead of disk files for sorting
> small SELECT results.  psort() is only called by ExecSort, which is used
> by ORDER BY's.
>
> Permission to put this in 6.1p1?

IMHO sounds like a *bad* idea, since it might take a while to debug.
Better to leave this as a feature for now (Postgres has had this
forever?) and come up with something great for v6.2; I'd be interested
in contributing to this if it would be helpful.

I don't know which Knuth algorithm the code uses, but some sort
algorithms perform very poorly on data which happens to be already
sorted. QuickSort, which comes on many Unix boxes (the qsort() call) is
quickest on completely unordered/disordered data and its slowest
performance is on already perfectly sorted data (I'm doing this from
memory, but the facts may be mostly correct :).

            - Tom

------------------------------

pgsql-hackers by date:

Previous
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] Problem with copying abstimes
Next
From: "Thomas G. Lockhart"
Date:
Subject: Re: [HACKERS] \dt and disk access