Re: Minor performance improvement in transition to external sort

From: Jeremy Harris <jgh(at)wizmail(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Minor performance improvement in transition to external sort
Date: 2014-02-21 00:27:28
Message-ID: 53069D70.9080403@wizmail.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/02/14 17:11, Jeremy Harris wrote:
> On 06/02/14 18:21, Jeff Janes wrote:
>> Did you try sorting already-sorted, reverse
>> sorted, or pipe-organ shaped data sets? We will also need to test it on
>> strings. I usually use md5(random()::text) to generate strings for such
>> purposes, at least for a first pass.
>
> Attached is version 2 of the patch, which fixes the performance on
> constant-input.

Having beaten on this some more I'm prepared to abandon it.

The wallclock time, for random input, drifts up at larger N
(compared to the existing code) despite the number of comparisons
being consistently less.

Run under cachegrind, it takes about N/10 last-level cache misses,
all for the new item being introduced to the heap. The existing
code takes none at all.

It might be worthwhile for a seriously expensive comparison function;
say, more than 50 clocks. For integers and md5-strings it isn't.
--
Cheers,
Jeremy

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-02-21 00:51:36 Re: jsonb and nested hstore
Previous Message Neil Thombre 2014-02-21 00:02:26 Re: pg_standby: Question about truncation of trigger file in fast failover