Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id BA21C9FB274 for ; Fri, 9 Feb 2007 00:11:58 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 46102-08 for ; Fri, 9 Feb 2007 00:11:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by postgresql.org (Postfix) with ESMTP id CA8999FB25C for ; Fri, 9 Feb 2007 00:11:53 -0400 (AST) Received: from [192.168.7.5] ([71.101.65.69]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JD600EMBGZRQ5HE@vms046.mailsrvcs.net> for pgsql-sql@postgresql.org; Thu, 08 Feb 2007 22:11:53 -0600 (CST) Date: Thu, 08 Feb 2007 23:12:14 -0500 From: Joe Subject: Re: huge disparities in =/IN/BETWEEN performance In-reply-to: <14273.1170993005@sss.pgh.pa.us> To: Tom Lane Cc: Alvaro Herrera , George Pavlov , pgsql-sql@postgresql.org Message-id: <1170994335.697.55.camel@pampa> Organization: Freedom Circle, LLC MIME-version: 1.0 X-Mailer: Evolution 2.8.3 FreeBSD GNOME Team Port Content-type: text/plain Content-transfer-encoding: 7bit References: <8C5B026B51B6854CBE88121DBF097A86815F42@ehost010-33.exch010.intermedia.net> <7377.1170986068@sss.pgh.pa.us> <8C5B026B51B6854CBE88121DBF097A86815F81@ehost010-33.exch010.intermedia.net> <20070209021414.GU24069@alvh.no-ip.org> <14273.1170993005@sss.pgh.pa.us> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/113 X-Sequence-Number: 27447 Hi Tom, On Thu, 2007-02-08 at 22:50 -0500, Tom Lane wrote: > There's a datatype abstraction issue involved: what does it take to > prove that "x >= 10 AND x <= 10" is equivalent to "x = 10"? This > requires a nontrivial amount of knowledge about the operators involved. > We could probably do it for operators appearing in a btree operator > class, but as Alvaro says, it'd be cycles wasted for non-dumb queries. Are you saying the planner is datatype-agnostic and can't tell that x is, say, as in the example above, an INTEGER and therefore cannot transform one expression into another? What about "x = 10 AND x < 5"? Can't it reduce that to FALSE? Joe