[Bizgres-general] Slow glibc qsort, two versions that are much faster

Luke Lonergan llonergan at greenplum.com
Fri Dec 9 08:43:26 GMT 2005


Simon,

On 12/9/05 12:36 AM, "Simon Riggs" <simon at 2ndquadrant.com> wrote:

>> In my tests (attached, and results below), the qsortG routine outperforms
>> the Linux/qlibc qsort routine by as much as 94% (10 times).  It's different
>> on Mac OSX and Solaris where the zero set seems to have a fast
>> implementation.
> 
> Sounds good and licence is compatible.

Yep!  Pleasant mathematician made it so.

> Can you explain the zero set thing a bit more? Not quite sure what that
> is. Empty set? All same key?

The "zero set" I refer to is just an array of all zero (all same key).  That
was brought forward as a catastrophic edge case for the Solaris qsort
implementation a few years ago.

I threw in a random set, and the reversed ordered set for comparison
purposes.  I'm not sure how to characterize all sort sets of interest.

> No, its not used.

Oh well.
 
> But this can still be important to us since we can now use multiple GBs
> of memory. With partitioning, we might find that is sufficient for many
> needs.

How does the existing logic work to choose between the N-tape algorithm and
the in-memory one?  Is it based on the estimated stats?

- Luke




More information about the Bizgres-general mailing list