Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 3AF6C9FB4EF for ; Fri, 30 Mar 2007 13:13:18 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 04330-04 for ; Fri, 30 Mar 2007 13:13:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id AFF259FB4E8 for ; Fri, 30 Mar 2007 13:13:10 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l2UGD0W0020400; Fri, 30 Mar 2007 12:13:00 -0400 (EDT) To: Richard Huxton cc: Gaetano Mendola , "pgsql-performance@postgresql.org" Subject: Re: Wrong plan sequential scan instead of an index one In-reply-to: <460CF902.4020707@archonet.com> References: <460CD941.6080303@bigfoot.com> <460CDCDC.7020901@archonet.com> <460CE359.8060208@bigfoot.com> <460CE775.8080908@archonet.com> <460CF40F.6060303@mbigroup.it> <460CF902.4020707@archonet.com> Comments: In-reply-to Richard Huxton message dated "Fri, 30 Mar 2007 12:48:18 +0100" Date: Fri, 30 Mar 2007 12:13:00 -0400 Message-ID: <20399.1175271180@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/453 X-Sequence-Number: 23858 Richard Huxton writes: > Ah, but it's got no way of knowing what matches you'll get for > '%anything%'. There's no easy way to get statistics for matching substrings. 8.2 actually tries the match on the most-common-values list, if said list is big enough (I think the threshold is stats target = 100). Not sure if that will help here, though. regards, tom lane