Re: Progress on fast path sorting, btree index creation time - Mailing list pgsql-hackers

From Peter Geoghegan
Subject Re: Progress on fast path sorting, btree index creation time
Date
Msg-id CAEYLb_UnKaBHk5xo329_b-7kxVw8xyJHYpixnBARxqwEH7HR3g@mail.gmail.com
Whole thread Raw
In response to Re: Progress on fast path sorting, btree index creation time  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Progress on fast path sorting, btree index creation time  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On 9 February 2012 14:51, Robert Haas <robertmhaas@gmail.com> wrote:
> I'm not sure I entirely follow all this, but I'll look at the code
> once you have it.

I have attached a revision of the patch, with the adjustments already
described. Note that I have not made this support btree tuplesorting
yet, as there is an impedance mismatch that must be resolved,
particularly with the SortSupport stuff, and I wanted to know what you
think of the multiple key specialisation first. Arguably, we could get
away with only a single specialisation - I haven't really though about
it much.

You say "Well, how often will we sort 10,000 integers?", and I think
that btree index creation is one very common and useful case, so I'd
like to look at that in more detail. I certainly don't see any reason
to not do it too.

This should give you performance for sorting multiple-keys that is
almost as good as the single-key optimisation that you found to be
more compelling. Obviously the need to actually call comparetup_heap
to look at non-leading sortkeys will vary from case to case, and this
is based on your test case, where there are no duplicates and thus no
need to ever do that. That isn't too far from representative, as I
think that in general, a majority of comparisons won't result in
equality.

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: psql tab completion for SELECT
Next
From: Robert Haas
Date:
Subject: Re: Patch: fix pg_dump for inherited defaults & not-null flags