Re: PoC: Partial sort

From: Marti Raudsepp <marti(at)juffo(dot)org>
To: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Andreas Karlsson <andreas(at)proxel(dot)se>, David Rowley <dgrowleyml(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Andres Freund <andres(at)2ndquadrant(dot)com>, Martijn van Oosterhout <kleptog(at)svana(dot)org>, Jeremy Harris <jgh(at)wizmail(dot)org>
Subject: Re: PoC: Partial sort
Date: 2014-01-18 19:47:39
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers

On Sat, Jan 18, 2014 at 7:22 PM, Marti Raudsepp <marti(at)juffo(dot)org> wrote:
> Total runtime: 5.418 ms

Oops, shouldn't have rushed this. Clearly the timings should have
tipped me off that it's broken. I didn't notice that cmpSortSkipCols
was re-using tuplesort's sortkeys.

Here's a patch that actually works; I added a new skipKeys attribute
to SortState. I had to extract the SortSupport-creation code from
tuplesort_begin_heap to a new function; but that's fine, because it
was already duplicated in ExecInitMergeAppend too.

I reverted the addition of tuplesort_get_sortkeys, which is not needed now.

Now the timings are:
Unpatched partial sort: 13478.158 ms
Full sort: 6802.063 ms
Patched partial sort: 6618.962 ms


Attachment Content-Type Size
0001-Partial-sort-skip-comparisons-for-known-equal-column.patch text/x-patch 8.1 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-01-18 20:26:24 Re: [PATCH] Make various variables read-only (const)
Previous Message Kevin Grittner 2014-01-18 19:45:23 Re: Race condition in b-tree page deletion