Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 38FED6503B9 for ; Mon, 4 Aug 2008 15:26:47 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 27774-04-7 for ; Mon, 4 Aug 2008 15:26:32 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by postgresql.org (Postfix) with ESMTP id 5309B6503F8 for ; Mon, 4 Aug 2008 15:16:56 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Mon, 04 Aug 2008 13:16:55 -0500 Message-Id: <4897013D.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0.3 Date: Mon, 04 Aug 2008 13:16:45 -0500 From: "Kevin Grittner" To: "ITAGAKI Takahiro" , "Albert Cervera Areny" Cc: Subject: Re: Posible planner improvement? References: <200805211228.48248.albert@sedifa.com> <20080526201825.C96D.52131E4D@oss.ntt.co.jp> In-Reply-To: <20080526201825.C96D.52131E4D@oss.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200808/6 X-Sequence-Number: 30887 >>> On Mon, May 26, 2008 at 6:30 AM, ITAGAKI Takahiro wrote: > Albert Cervera Areny wrote: > >> I've got a query similar to this: >> >> select * from t1, t2 where t1.id > 158507 and t1.id = t2.id; >> >> That took > 84 minutes (the query was a bit longer but this is the part that >> made the difference) after a little change the query took ~1 second: >> >> select * from t1, t2 where t1.id > 158507 and t2.id > 158507 and t1.id = >> t2.id; > > I had a similar problem here: > http://archives.postgresql.org/pgsql-general/2007-02/msg00850.php > and added a redundant inequality explicitly to make it work well. > > I think it is worth trying to improve, but I'm not sure we can do it > against user defined types. Does postgres always require transitive law > to all types? I've recently run into this. It would be a nice optimization, if feasible. -Kevin