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 C2DD89F9F8F for ; Thu, 18 May 2006 12:59:20 -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 27681-10 for ; Thu, 18 May 2006 12:59:08 -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 2A8159F969C for ; Thu, 18 May 2006 12:59:07 -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 1Fgku1-0001rX-QZ for pgsql-performance@postgresql.org; Thu, 18 May 2006 17:59:06 +0200 Received: from sesse by trofast.sesse.net with local (Exim 3.36 #1 (Debian)) id 1Fgku2-0001pN-00 for ; Thu, 18 May 2006 17:59:06 +0200 Date: Thu, 18 May 2006 17:59:06 +0200 From: "Steinar H. Gunderson" To: pgsql-performance@postgresql.org Subject: Re: why is bitmap index chosen for this query? Message-ID: <20060518155906.GA6909@uio.no> Mail-Followup-To: pgsql-performance@postgresql.org References: <20060518155204.66320.qmail@web30701.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20060518155204.66320.qmail@web30701.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/391 X-Sequence-Number: 19178 On Thu, May 18, 2006 at 08:52:04AM -0700, Stephen Byers wrote: > Could someone explain the results of the following? It sounds like PostgreSQL badly overestimates the cost of the index scan. Does the table perchance fit completely into memory, without effective_cache_size indicating that? > Also, what is Recheck Cond? The bitmap index scan will by default allocate one bit per tuple. If it can't hold a complete bitmap of every tuple in memory, it will fall back to allocating one bit per (8 kB) page, since it will have to read the entire page anyhow, and the most dramatic cost is the seek. However, in the latter case, it will also get a few extra records that don't match the original clause, so it will have to recheck the condition ("Recheck Cond") before outputting the tuples to the parent node. /* Steinar */ -- Homepage: http://www.sesse.net/