Re: Estimation problem with a LIKE clause containing a /

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Guillaume Smet" <guillaume(dot)smet(at)gmail(dot)com>
Cc: 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-08 17:22:28
Message-ID: 27405.1194542548@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

"Guillaume Smet" <guillaume(dot)smet(at)gmail(dot)com> writes:
> On Nov 8, 2007 12:14 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> I've applied a patch that might help you:
>> http://archives.postgresql.org/pgsql-committers/2007-11/msg00104.php

> AFAICS, it doesn't seem to fix the problem. I just compiled
> REL8_1_STABLE branch and I still has the following behaviour:

OK, I tried it in fr_FR locale and what I find is that

regression=# select '123/' < '1230'::text;
?column?
----------
t
(1 row)

so make_greater_string() will still think that its first try at
generating an upper-bound string is good enough. However

regression=# select '123/1' < '1230'::text;
?column?
----------
f
(1 row)

so the data starting with '123/' is still outside the generated range,
leading to a wrong estimate. I didn't see this behavior yesterday but
I was experimenting with en_US which I guess has different rules.

What I am tempted to do about this is have make_greater_string tack "zz"
onto the supplied prefix, so that it would have to find a string that
compares greater than "123/zz" before reporting success. This is
getting pretty klugy though, so cc'ing to pgsql-hackers to see if anyone
has a better idea.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brendan Jurd 2007-11-08 18:00:04 Re: A small rant about coding style for backend functions
Previous Message Tom Lane 2007-11-08 16:34:55 Re: New tzdata available

Browse pgsql-performance by date

  From Date Subject
Next Message Scott Marlowe 2007-11-08 18:22:48 Re: dell versus hp
Previous Message Robert Treat 2007-11-08 17:14:35 Re: Hardware for PostgreSQL