Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 127C19FB797 for ; Thu, 24 May 2007 22:08:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 74178-05 for ; Thu, 24 May 2007 22:08:29 -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 1CF2B9FB666 for ; Thu, 24 May 2007 22:08:34 -0300 (ADT) 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 l4P18Bfp027829; Thu, 24 May 2007 21:08:11 -0400 (EDT) To: "George Pavlov" cc: pgsql-general@postgresql.org Subject: Re: index vs. seq scan choice? In-reply-to: <8C5B026B51B6854CBE88121DBF097A86C3A30D@ehost010-33.exch010.intermedia.net> References: <8C5B026B51B6854CBE88121DBF097A86C3A30D@ehost010-33.exch010.intermedia.net> Comments: In-reply-to "George Pavlov" message dated "Thu, 24 May 2007 16:15:54 -0700" Date: Thu, 24 May 2007 21:08:11 -0400 Message-ID: <27828.1180055291@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/1229 X-Sequence-Number: 114423 "George Pavlov" writes: > I am curious what could make the PA query to ignore the index. What are > the specific stats that are being used to make this decision? The frequency of the specific value being searched for, and the overall order-correlation of the column. Since the latter is not dependent on a particular value, my guess at the reason for the inconsistent results is that you don't have the column's statistics target set high enough to track all the interesting values --- or maybe just not high enough to acquire sufficiently accurate frequency estimates for them. Take a look at the pg_stats row for the column ... (The default statistics target is 10, which is widely considered too low --- you might find 100 more suitable.) regards, tom lane