X-Original-To: pgsql-performance-postgresql.org@postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id A4E1B9FAE4E for ; Tue, 12 Sep 2006 11:52:35 -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 49739-07 for ; Tue, 12 Sep 2006 11:52:25 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 15E809FA433 for ; Tue, 12 Sep 2006 11:52:25 -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 k8CEqLIP016189; Tue, 12 Sep 2006 10:52:21 -0400 (EDT) To: Alvaro Herrera cc: Heikki Linnakangas , Guillaume Cottenceau , pgsql-performance@postgresql.org Subject: Re: Poor performance on seq scan In-reply-to: <20060912133254.GC11324@alvh.no-ip.org> References: <450684EC.4090304@designaproduct.biz> <4506902C.7090407@enterprisedb.com> <4506A9E7.2060303@designaproduct.biz> <87y7spw8v9.fsf@meuh.mnc.lan> <4506B508.80806@enterprisedb.com> <20060912133254.GC11324@alvh.no-ip.org> Comments: In-reply-to Alvaro Herrera message dated "Tue, 12 Sep 2006 09:32:55 -0400" Date: Tue, 12 Sep 2006 10:52:21 -0400 Message-ID: <16188.1158072741@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.109 tagged_above=0 required=5 tests=AWL, SPF_HELO_PASS, SPF_PASS X-Spam-Level: X-Archive-Number: 200609/85 X-Sequence-Number: 20771 Alvaro Herrera writes: > Are you saying that an indexscan "Filter" only acts after getting the > heap tuple? Correct. > If that's the case, then there's room for optimization > here, namely if the affected column is part of the index key, then we > could do the filtering before fetching the heap tuple. Only if the index is capable of disgorging the original value of the indexed column, a fact not in evidence in general (counterexample: polygons indexed by their bounding boxes in an r-tree). But yeah, it's interesting to think about applying filters at the index fetch step for index types that can hand back full values. This has been discussed before --- I think we had gotten as far as speculating about doing joins with just index values. See eg here: http://archives.postgresql.org/pgsql-hackers/2004-05/msg00944.php A lot of the low-level concerns have already been dealt with in order to support bitmap indexscans, but applying non-indexable conditions before fetching from the heap is still not done. regards, tom lane