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 6989653AA2 for ; Fri, 8 Apr 2005 00:58:56 +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 56462-04 for ; Thu, 7 Apr 2005 23:58:54 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id E621153A59 for ; Fri, 8 Apr 2005 00:58:53 +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 j37NwueE023153; Thu, 7 Apr 2005 19:58:56 -0400 (EDT) To: Mischa Cc: pgsql-performance@postgresql.org Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) In-reply-to: <1112909198.4255a58eae0d8@webmail.telus.net> 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> <16907.1112883624@sss.pgh.pa.us> <1112909198.4255a58eae0d8@webmail.telus.net> Comments: In-reply-to Mischa message dated "Thu, 07 Apr 2005 14:26:38 -0700" Date: Thu, 07 Apr 2005 19:58:56 -0400 Message-ID: <23152.1112918336@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/174 X-Sequence-Number: 11571 Mischa writes: > Quoting Tom Lane : >> WHERE a.x > b.y AND a.x < 42 > Out of curiosity, will the planner induce "b.y < 42" out of this? No. There's some smarts about transitive equality, but none about transitive inequalities. Offhand I'm not sure if it'd be useful to add such. The transitive-equality code pulls its weight because you so often have situations like create view v as select a.x, ... from a join b on (a.x = b.y); select * from v where x = 42; but I'm less able to think of common use-cases for transitive inequality ... regards, tom lane