Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id EA0589FBDF1 for ; Fri, 30 Mar 2007 07:55:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 63765-04 for ; Fri, 30 Mar 2007 07:55:40 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by postgresql.org (Postfix) with ESMTP id A247B9FBDFA for ; Fri, 30 Mar 2007 07:55:44 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.8/8.13.8) with ESMTP id l2UAtZjs000577 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 30 Mar 2007 04:55:37 -0600 (MDT) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.8/8.13.8) with ESMTP id l2UAtYeL001782; Fri, 30 Mar 2007 04:55:34 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.8/8.13.8/Submit) id l2UAtYZe001781; Fri, 30 Mar 2007 04:55:34 -0600 (MDT) (envelope-from mfuhr) Date: Fri, 30 Mar 2007 04:55:34 -0600 From: Michael Fuhr To: Gaetano Mendola Cc: "pgsql-performance@postgresql.org" , Claus Guttesen Subject: Re: Wrong plan sequential scan instead of an index one Message-ID: <20070330105534.GA1737@winnie.fuhr.org> References: <460CD941.6080303@bigfoot.com> <460CE19A.3060909@bigfoot.com> <20070330104611.GA1540@winnie.fuhr.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070330104611.GA1540@winnie.fuhr.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/444 X-Sequence-Number: 23849 On Fri, Mar 30, 2007 at 04:46:11AM -0600, Michael Fuhr wrote: > Have you tried increasing the statistics target on l_pvcp.value? > I ran your queries against canned data in 8.2.3 and better statistics > resulted in more accurate row count estimates for this and other > parts of the plan. I don't recall if estimates for non-leading-character > matches in earlier versions can benefit from better statistics. This might work only in 8.2. I see the following in the Release Notes: * Improve the optimizer's selectivity estimates for LIKE, ILIKE, and regular expression operations (Tom) -- Michael Fuhr