Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id D278E9FC81F for ; Wed, 7 Nov 2007 12:35:01 -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 49283-06 for ; Wed, 7 Nov 2007 12:34:58 -0400 (AST) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 2A2B49F926D for ; Wed, 7 Nov 2007 12:34:54 -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 lA7GYqKd017768; Wed, 7 Nov 2007 11:34:52 -0500 (EST) To: "Guillaume Smet" cc: pgsql-performance Subject: Re: Estimation problem with a LIKE clause containing a / In-reply-to: <1d4e0c10711070453q214f089cpd144cbb5193d3c4f@mail.gmail.com> References: <1d4e0c10711070453q214f089cpd144cbb5193d3c4f@mail.gmail.com> Comments: In-reply-to "Guillaume Smet" message dated "Wed, 07 Nov 2007 13:53:16 +0100" Date: Wed, 07 Nov 2007 11:34:52 -0500 Message-ID: <17767.1194453292@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/82 X-Sequence-Number: 27497 "Guillaume Smet" writes: > [ bad estimate for LIKE ] Hmmm ... what locale are you working in? I notice that the range estimator for this pattern would be "ancestors >= '1062/' AND ancestors < '10620'", which will do the right thing in C locale but maybe not so much elsewhere. > Version is PostgreSQL 8.1.8 on i686-redhat-linux-gnu, You'd probably get better results with 8.2, which has a noticeably smarter LIKE-estimator, at least for histogram sizes of 100 or more. regards, tom lane