Re: [PERFORM] Estimation problem with a LIKE clause containing a / - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PERFORM] Estimation problem with a LIKE clause containing a /
Date
Msg-id 25287.1194568820@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PERFORM] Estimation problem with a LIKE clause containing a /  (Gregory Stark <stark@enterprisedb.com>)
Responses Re: [PERFORM] Estimation problem with a LIKE clause containing a /  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Gregory Stark <stark@enterprisedb.com> writes:
> Doesn't really strike at the core reason that this is so klugy though. Surely
> the "right" thing is to push the concept of open versus closed end-points
> through deeper into the estimation logic?

No, the right thing is to take the folk who defined "dictionary sort
order" out behind the barn and shoot 'em ;-).  This has got nothing to
do with open/closed endpoints and everything to do with the bizarre
sorting rules used by some locales.  In particular the reason I want to
append a letter is that some locales discriminate against non-letter
characters in the first pass of sorting.

I did do some experimentation and found that among the ASCII characters
(ie, codes 32-126), nearly all the non-C locales on my Fedora machine
sort Z last and z next-to-last or vice versa.  Most of the remainder
sort digits last and z or Z as the last non-digit character.  Since Z is
not that close to the end of the sort order in C locale, however, z
seems the best bet.

            regards, tom lane

pgsql-hackers by date:

Previous
From: Gregory Stark
Date:
Subject: Re: [PERFORM] Estimation problem with a LIKE clause containing a /
Next
From: Alvaro Herrera
Date:
Subject: Re: Free Space Map thoughts