X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id F19E09FA2EB for ; Thu, 18 May 2006 16:48:25 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 67992-07 for ; Thu, 18 May 2006 16:48:16 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [129.241.93.19]) by postgresql.org (Postfix) with ESMTP id A39669F9C18 for ; Thu, 18 May 2006 16:48:16 -0300 (ADT) Received: from trofast.ipv6.sesse.net ([2001:700:300:dc03:20e:cff:fe36:a766] helo=trofast.sesse.net) by cassarossa.samfundet.no with esmtp (Exim 4.50) id 1FgoTk-0001oV-IY for pgsql-performance@postgresql.org; Thu, 18 May 2006 21:48:13 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1FgoTl-0002EH-00 for ; Thu, 18 May 2006 21:48:13 +0200 Date: Thu, 18 May 2006 21:48:13 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: why is bitmap index chosen for this query? Message-ID: <20060518194813.GA8539@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <16019.1147973659@sss.pgh.pa.us> <20060518193818.81332.qmail@web30710.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20060518193818.81332.qmail@web30710.mail.mud.yahoo.com> X-Operating-System: Linux 2.6.16.11 on a x86_64 X-Message-Flag: Outlook? --> http://www.mozilla.org/products/thunderbird/ User-Agent: Mutt/1.5.11+cvs20060403 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200605/397 X-Sequence-Number: 19184 On Thu, May 18, 2006 at 12:38:18PM -0700, Stephen Byers wrote: > I repeated explain analyze on the query 5 times and it came up with the same plan. Yes, but did it end up with the same runtime? That's the interesting part -- the plan will almost always be identical between explain analyze runs given that you haven't done anything in between them. > You asked about index order and physical table order. In general the index > order is indeed close to the same order as the physical table order. > However, this query is likely an exception. The data is actually from a > backup server that has filled a hole for some of the time range that I'm > specifying in my query. Well, it still isn't all that far-fetched to believe that the data has lots of correlation (which helps the index scan quite a lot) that the planner isn't able to pick up. I don't know the details here, so I can't tell you how the correlation for such a query (WHERE a=foo and b between bar and baz) is estimated. Something tells me someone else might, though. :-) /* Steinar */ -- Homepage: http://www.sesse.net/