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-08-06 23:18:50
Message-ID: CAM3SWZREwkPjYurpUsV+Twg3Gg5k4LM95J=o6B+5X7yZ9ruSkg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Aug 6, 2014 at 1:11 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> I've committed the patch I posted yesterday. I did not see a good
> reason to meld that together in a single commit with the first of the
> patches you posted; I'll leave you to revise that patch to conform
> with this approach.

Okay. Attached is the same patch set, rebased on top on your commit
with appropriate amendments.

BTW, I haven't added any of the same "portability" measures that the
existing strxfrm() selfuncs.c caller has. Since Windows can only use
the optimization with the C locale, I don't believe we're affected,
although the link
"http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=99694"
is now dead (even if you have a Microsoft account), so I won't swear
that Visual Studio 2005 is unaffected in the "C" locale case. However,
only VS 2008 and later versions support 64-bit builds, and only 64-bit
builds support abbreviated keys within sort support for text, so it
doesn't matter. As for the Solaris bugs that convert_string_datum()
also refers to, well, I just don't have much sympathy for that case.
If a version of Solaris that was old in 2003 still has a buggy
strxfrm() implementation and wants to use Postgres 9.5, too bad. My
usage of strxfrm() is the pattern that the standard expects. The idea
that we should always do a dry-run, where strxfrm() is called with a
NULL pointer to check how much memory is required, just because
somebody's strxfrm() is so badly written as to feel entitled to write
past the end of my buffer is just absurd. That should probably be
removed from the existing convert_string_datum() strxfrm() call site
too. I suspect that no Oracle-supported version of Solaris will be
affected, but if I'm wrong, that's what we have a buildfarm for.

The nodeAgg.c FIXME item remains. I've added a new TODO comment which
suggests that we investigate more opportunistic attempts at getting
away with a cheap memcmp() that indicates equality. That continues to
only actually occur when the sort support comparator is called as a
tie-breaker.

--
Peter Geoghegan

Attachment Content-Type Size
0002-Abbreviated-sortsupport-keys.patch text/x-patch 53.6 KB
0001-sortsupport-for-text.patch text/x-patch 10.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Janes 2014-08-06 23:20:01 Re: Fixed redundant i18n strings in json
Previous Message Marko Tiikkaja 2014-08-06 22:11:42 Re: plpgsql.extra_warnings='num_into_expressions'