Re: Why do we still perform a check for pre-sorted input within qsort variants? - Mailing list pgsql-hackers

From Dann Corbit
Subject Re: Why do we still perform a check for pre-sorted input within qsort variants?
Date
Msg-id 87F42982BF2B434F831FCEF4C45FC33E5BD36624@EXCHANGE.corporate.connx.com
Whole thread Raw
In response to Re: Why do we still perform a check for pre-sorted input within qsort variants?  (Peter Geoghegan <peter.geoghegan86@gmail.com>)
List pgsql-hackers
-----Original Message-----
From: Peter Geoghegan [mailto:peter.geoghegan86@gmail.com]
Sent: Friday, March 08, 2013 12:00 PM
To: Bruce Momjian
Cc: Dann Corbit; Robert Haas; Tom Lane; PG Hackers
Subject: Re: [HACKERS] Why do we still perform a check for pre-sorted input within qsort variants?

On 8 March 2013 11:48, Bruce Momjian <bruce@momjian.us> wrote:
> On Fri, Mar 8, 2013 at 07:43:10PM +0000, Dann Corbit wrote:
>> I seem to recall that a year or two back some study was done on
>> quicksort methodology as used in PostgreSQL.  As I recall, the
>> algorithm used in PostgreSQL fared well in the tests.
>
> Well, that's good to hear.

I wouldn't mind taking a look at that. We're not the only ones that use (more or less) that same algorithm. I noticed
thatRedis does so too, just for example (though they didn't get wise to the problems with the "swap_cnt"
pessimisation).

>>
Turns out, it was a lot longer ago than I thought (2005!).  The thread was called "Which qsort is used", but I also
seemto recall that the topic was revisited a few times.  See, for instance: 

http://www.postgresql.org/message-id/Pine.LNX.4.58.0512121138080.18520@eon.cs
http://www.cs.toronto.edu/~zhouqq/postgresql/sort/sort.html

<<



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Why do we still perform a check for pre-sorted input within qsort variants?
Next
From: Robert Haas
Date:
Subject: Re: Duplicate JSON Object Keys