Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id B680F9F9773 for ; Fri, 10 Aug 2007 17:05:39 -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 49711-01 for ; Fri, 10 Aug 2007 17:05:31 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from mu-out-0910.google.com (mu-out-0910.google.com [209.85.134.190]) by postgresql.org (Postfix) with ESMTP id 82FC29F9860 for ; Fri, 10 Aug 2007 17:05:33 -0300 (ADT) Received: by mu-out-0910.google.com with SMTP id i10so1208414mue for ; Fri, 10 Aug 2007 13:05:32 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=EYDcvogkqBTSsql805ug+Y1gCbRXMFJtOM3ks4PJOiAv6XBAwJIH+MKgfn2X8THleSyR56x0hFfe7P0+vAEdo0XzUeCMnsXwgbY8dlM2CxlWnnZFeoa+k3v4FMZcspY0+mdyB1DuE1+JrN9Uva1Iy5xFQpUYd7kUwwAAH3+mmqo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:user-agent:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding:sender; b=maTOftZoD7B00Xucfp14TGYVIBq0o5a/enzKszYFshslndZC7CLLL3vgtJSfUUBO7u4a+cu9tJx6IXlU66s/Tdre/Tyv7qAEQBK1+uDqVxCyNWK5ES9gSPptLwzAHxRX60gdJww037UdpqsIUisjOTUE/spZK/OkqGkufv9klCU= Received: by 10.86.79.19 with SMTP id c19mr2574748fgb.1186776331445; Fri, 10 Aug 2007 13:05:31 -0700 (PDT) Received: from ?192.168.0.199? ( [80.222.48.97]) by mx.google.com with ESMTPS id p9sm6103410fkb.2007.08.10.13.05.28 (version=SSLv3 cipher=RC4-MD5); Fri, 10 Aug 2007 13:05:29 -0700 (PDT) Message-ID: <46BCC4F9.70903@enterprisedb.com> Date: Fri, 10 Aug 2007 21:05:13 +0100 From: Heikki Linnakangas User-Agent: Icedove 1.5.0.10 (X11/20070329) MIME-Version: 1.0 To: Kevin Grittner CC: pgsql-performance@postgresql.org Subject: Re: Bitmap Index Scan optimization opportunity References: <46BC7737.EE98.0025.0@wicourts.gov> In-Reply-To: <46BC7737.EE98.0025.0@wicourts.gov> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/114 X-Sequence-Number: 26244 Kevin Grittner wrote: > These query times are the "fully cached" times for both, from doing a previous run of the same query. (The first one took 193.772 ms on its first run; I don't have a good "uncached" timing for the second one at this point.) > > It seems like the first query could move the searchName filter to the Bitmap Index Scan phase, and save 97.5% of the page retrievals in the Bitmap Heap Scan. Yes it could in theory, but unfortunately the planner/executor doesn't have the capability to do that. An indexed value is never handed back from the index; the indexed values are only used to satisfy index conditions, not filters. It's been discussed before (see http://archives.postgresql.org/pgsql-performance/2006-09/msg00080.php), but it's not easy to implement so no one's done it yet. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com