Re: PoC: Partial sort - Mailing list pgsql-hackers

From Marti Raudsepp
Subject Re: PoC: Partial sort
Date
Msg-id CABRT9RD_YVct+S5tWZSzq7bp+AeqUTo6BaASp9ytpENajEFUpw@mail.gmail.com
Whole thread Raw
In response to Re: PoC: Partial sort  (Marti Raudsepp <marti@juffo.org>)
List pgsql-hackers
On Sat, Jan 18, 2014 at 7:22 PM, Marti Raudsepp <marti@juffo.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

Regards,
Marti

Attachment

pgsql-hackers by date:

Previous
From: Kevin Grittner
Date:
Subject: Re: Race condition in b-tree page deletion
Next
From: Tom Lane
Date:
Subject: Re: [PATCH] Make various variables read-only (const)