Re: B-Tree support function number 3 (strxfrm() optimization)

From: Peter Geoghegan <pg(at)heroku(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>, Noah Misch <noah(at)leadboat(dot)com>, Marti Raudsepp <marti(at)juffo(dot)org>, Stephen Frost <sfrost(at)snowman(dot)net>, Greg Stark <stark(at)mit(dot)edu>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thom Brown <thom(at)linux(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: B-Tree support function number 3 (strxfrm() optimization)
Date: 2014-09-03 00:29:06
Message-ID: CAM3SWZQ2xazBo8YdMKVhY1DgqyL0ynvYbfs6zD=QMkxWH_YDFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Sep 2, 2014 at 12:22 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> That would have the
> nice property of avoiding the need for special handling in
> reversedirection_heap().

Oh, BTW, we probably don't need that anyway, since I'm already
disabling abbreviated key optimization in the event of a bounded sort
on the grounds that in general it doesn't pay for itself. So maybe
reversedirection_heap() (and perhaps other tuple-type variants of
same) should merely note: "If ever abbreviated keys with top-N heap
sort start to make sense, the logic to invert ordering would have to
be duplicated here". Technically, right now what I've added to
reversedirection_heap() is dead code. What do you think of that?

It's still not clear that the explicit "tie-breaker" comparator
introspection is paying for itself: as I've already pointed out, we
may well be better off always trying a memcmp() tie-breaker first, and
not bothering with the distinction between whether or not a given
comparison has been called as a tie-breaker, or whether there never
was an abbreviated comparison to have to tie-break in the first place.
Even if we're better off always being optimistic about a "try memcmp()
== 0" paying off for text, there are other datatypes, and it might be
a more useful distinction for those other datatypes. Which is not to
suggest that it's clear that it isn't a useful distinction to make in
the case of text.

--
Peter Geoghegan

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Browne 2014-09-03 00:46:36 Re: PL/pgSQL 2
Previous Message Bruce Momjian 2014-09-03 00:18:59 Re: Need Multixact Freezing Docs