X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 5528F53533 for ; Thu, 7 Apr 2005 00:11:44 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 38964-03 for ; Wed, 6 Apr 2005 23:11:40 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id A9BB2534F9 for ; Thu, 7 Apr 2005 00:11:39 +0100 (BST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j36N6Y7s006828; Wed, 6 Apr 2005 19:06:34 -0400 (EDT) To: John A Meinel Cc: "Jim C. Nasby" , Arjen van der Meijden , pgsql-hackers@postgresql.org, pgsql-performance@postgresql.org Subject: Re: [HACKERS] Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) In-reply-to: <4254688F.6070009@arbash-meinel.com> References: <425413D3.5030304@vulcanus.its.tudelft.nl> <28552.1112809334@sss.pgh.pa.us> <425423A9.9000504@vulcanus.its.tudelft.nl> <5999.1112820690@sss.pgh.pa.us> <6326.1112825377@sss.pgh.pa.us> <20050406222536.GL93835@decibel.org> <6594.1112826910@sss.pgh.pa.us> <4254688F.6070009@arbash-meinel.com> Comments: In-reply-to John A Meinel message dated "Wed, 06 Apr 2005 17:54:07 -0500" Date: Wed, 06 Apr 2005 19:06:34 -0400 Message-ID: <6827.1112828794@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/131 X-Sequence-Number: 11528 John A Meinel writes: > Actually, I think he was saying do a nested loop, and for each item in > the nested loop, re-evaluate if an index or a sequential scan is more > efficient. > I don't think postgres re-plans once it has started, though you could > test this in a plpgsql function. It doesn't, and in any case that's a microscopic view of the issue. The entire shape of the plan might change depending on what we think the selectivity is --- much more than could be handled by switching scan types at the bottom level. Also, I anticipate that bitmap-driven index scans will change things considerably here. The range of usefulness of pure seqscans will drop drastically... regards, tom lane