Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 0CE829FCB65; Thu, 8 Nov 2007 13:22:39 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 94947-04; Thu, 8 Nov 2007 13:22:33 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id AE2709F9243; Thu, 8 Nov 2007 13:22:32 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id lA8HMSlk027406; Thu, 8 Nov 2007 12:22:29 -0500 (EST) To: "Guillaume Smet" cc: pgsql-performance , pgsql-hackers@postgresql.org Subject: Re: Estimation problem with a LIKE clause containing a / In-reply-to: <1d4e0c10711080208n6c9875b4tf5882da3ced18532@mail.gmail.com> References: <1d4e0c10711070453q214f089cpd144cbb5193d3c4f@mail.gmail.com> <17767.1194453292@sss.pgh.pa.us> <11467.1194477248@sss.pgh.pa.us> <1d4e0c10711080208n6c9875b4tf5882da3ced18532@mail.gmail.com> Comments: In-reply-to "Guillaume Smet" message dated "Thu, 08 Nov 2007 11:08:33 +0100" Date: Thu, 08 Nov 2007 12:22:28 -0500 Message-ID: <27405.1194542548@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/109 X-Sequence-Number: 27524 "Guillaume Smet" writes: > On Nov 8, 2007 12:14 AM, Tom Lane 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