Re: Estimation problem with a LIKE clause containing a /

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gregory Stark <stark(at)enterprisedb(dot)com>
Cc: "Guillaume Smet" <guillaume(dot)smet(at)gmail(dot)com>, "pgsql-performance" <pgsql-performance(at)postgresql(dot)org>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Estimation problem with a LIKE clause containing a /
Date: 2007-11-09 00:40:20
Message-ID: 25287.1194568820@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Gregory Stark <stark(at)enterprisedb(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2007-11-09 00:50:13 Re: Free Space Map thoughts
Previous Message Gregory Stark 2007-11-08 23:10:49 Re: Estimation problem with a LIKE clause containing a /

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-11-09 00:42:31 Re: Join performance
Previous Message Tom Lane 2007-11-09 00:15:05 Re: Join performance