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 10FF653B21 for ; Fri, 8 Apr 2005 01:30:12 +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 65243-06 for ; Fri, 8 Apr 2005 00:30:09 +0000 (GMT) Received: from priv-edtnes56.telusplanet.net (outbound01.telus.net [199.185.220.220]) by svr1.postgresql.org (Postfix) with ESMTP id 25F4A53B09 for ; Fri, 8 Apr 2005 01:30:08 +0100 (BST) Received: from localhost ([199.185.220.240]) by priv-edtnes56.telusplanet.net (InterMail vM.6.01.04.00 201-2131-118-20041027) with ESMTP id <20050408003011.RNLR9708.priv-edtnes56.telusplanet.net@localhost>; Thu, 7 Apr 2005 18:30:11 -0600 Received: from 209.17.183.249 ( [209.17.183.249]) as user a3a18850@192.168.200.1 by webmail.telus.net with HTTP; Thu, 7 Apr 2005 17:30:11 -0700 Message-ID: <1112920211.4255d0934e23d@webmail.telus.net> Date: Thu, 7 Apr 2005 17:30:11 -0700 From: a3a18850@telus.net To: Tom Lane Cc: Mischa , pgsql-performance@postgresql.org Subject: Re: Recognizing range constraints (was Re: Plan for relatively simple query seems to be very inefficient) 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> <23152.1112918336@sss.pgh.pa.us> In-Reply-To: <23152.1112918336@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit User-Agent: Internet Messaging Program (IMP) 3.1-cvs X-Originating-IP: 209.17.183.249 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=2.418 tagged_above=0 required=5 tests=DNS_FROM_RFC_POST, FORGED_RCVD_HELO, FROM_ENDS_IN_NUMS, FROM_HAS_MIXED_NUMS, NO_REAL_NAME X-Spam-Level: ** X-Archive-Number: 200504/204 X-Sequence-Number: 11601 Quoting Tom Lane : > 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 [...] > but I'm less able to think of common use-cases for transitive > inequality ... Thanks. My apologies for not just going and looking at the code first. Equality-transitives: yes, worth their weight in gold. Inequality-transitivies: I see in OLAP queries (usually ranges), or in queries against big UNION ALL views, where const false inequalities are the norm. "a.x > b.y and a.x < c.z" comes up in OLAP, too, usually inside an EXISTS(...), where you are doing something analogous to finding a path.