Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 5F5139F9242 for ; Wed, 7 Nov 2007 12:52:31 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 63455-05 for ; Wed, 7 Nov 2007 12:52:28 -0400 (AST) Received: from fk-out-0910.google.com (fk-out-0910.google.com [209.85.128.188]) by postgresql.org (Postfix) with ESMTP id 044009F924E for ; Wed, 7 Nov 2007 12:52:26 -0400 (AST) Received: by fk-out-0910.google.com with SMTP id b27so2426866fka for ; Wed, 07 Nov 2007 08:52:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=Wb/GywoJXEo/yXxgP2pRlgajpKz+R03Iv+3kq2jKb7U=; b=JRebBJqHKCa8uYbifvfJqSipQOAHzmf4OIjLLEp4mZ6mYzZCtvN+Jfb2mnBdB+/2z70uDW56wGKIOICs2w+7LXuWnPaq+wRDZQRKEK9F8IrICQOF6+MEzKGBrBTBGduo/iNpSCmkysmuBd8Q3H1VwhTiHvwTMUNnAPctkK4U7lc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=IPMkSVq1FQCdnrQmfCaNZ8noXafL2abc8HOde9cr+KI2sckAuzpQWyh45jpwLV6xEKhoLTZHyx7mgN4zxyXrb3Z1YCu+JOoVrQiGaULEAxcadpQhNqZj67CRE21S7lYFndJSS9/WTRkbLC6RsQnc5H0qbctDuzJC8vSGP1Gh310= Received: by 10.82.162.14 with SMTP id k14mr15624133bue.1194454336243; Wed, 07 Nov 2007 08:52:16 -0800 (PST) Received: by 10.82.118.6 with HTTP; Wed, 7 Nov 2007 08:52:16 -0800 (PST) Message-ID: <1d4e0c10711070852hfc8aaf2o6eb0cdace2efc9b5@mail.gmail.com> Date: Wed, 7 Nov 2007 17:52:16 +0100 From: "Guillaume Smet" To: "Tom Lane" Subject: Re: Estimation problem with a LIKE clause containing a / Cc: pgsql-performance In-Reply-To: <17767.1194453292@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1d4e0c10711070453q214f089cpd144cbb5193d3c4f@mail.gmail.com> <17767.1194453292@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200711/83 X-Sequence-Number: 27498 On 11/7/07, Tom Lane wrote: > 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. Sorry for not having mentioned it before. Locale is UTF-8. > > 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. It's not really possible to upgrade this application to 8.2 for now. It's a very old app based on the thing formerly called as Red Hat WAF and now known as APLAWS and validating WAF and this application with 8.2 will take quite some time. Moreover the db is big and we can't afford the downtime of a migration. I suppose my best bet is to remove the pg_statistic line and to set the statistics to 0 for this column so that the stats are never generated again for this column? Thanks, -- Guillaume