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 3984C539AA; Thu, 7 Apr 2005 15:20:32 +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 89949-01; Thu, 7 Apr 2005 14:20:20 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 543DE52808; Thu, 7 Apr 2005 15:20:19 +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 j37EKOKs016908; Thu, 7 Apr 2005 10:20:24 -0400 (EDT) To: Bruno Wolff III Cc: Arjen van der Meijden , pgsql-hackers@postgreSQL.org, pgsql-performance@postgreSQL.org Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) In-reply-to: <20050407143120.GA29575@wolff.to> 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> <20050407143120.GA29575@wolff.to> Comments: In-reply-to Bruno Wolff III message dated "Thu, 07 Apr 2005 09:31:20 -0500" Date: Thu, 07 Apr 2005 10:20:24 -0400 Message-ID: <16907.1112883624@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/154 X-Sequence-Number: 11551 Bruno Wolff III writes: > Tom Lane wrote: >> Can anyone suggest a more general rule? > I think it makes sense to guess that a smaller fraction of the rows will > be returned when a column value is bounded above and below than if it > is only bounded on one side, even if the bounds aren't fixed. You can > certainly be wrong. Yeah, the whole thing is only a heuristic anyway. I've been coming around to the view that relation membership shouldn't matter, because of cases like WHERE a.x > b.y AND a.x < 42 which surely should be taken as a range constraint. regards, tom lane