Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 065862E00C7 for ; Mon, 26 May 2008 08:30:25 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 23087-03 for ; Mon, 26 May 2008 08:29:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from serv2.oss.ntt.co.jp (serv2.oss.ntt.co.jp [222.151.198.100]) by developer.postgresql.org (Postfix) with ESMTP id 958872E002D for ; Mon, 26 May 2008 08:29:51 -0300 (ADT) Received: from serv2.oss.ntt.co.jp (localhost [127.0.0.1]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id 1106A24809D; Mon, 26 May 2008 20:29:48 +0900 (JST) Received: from serv1.oss.ntt.co.jp (serv1.localdomain [172.19.0.2]) by serv2.oss.ntt.co.jp (Postfix) with ESMTP id F406D24809C; Mon, 26 May 2008 20:29:47 +0900 (JST) Received: from [127.0.0.1] (unknown [172.17.1.113]) by serv1.oss.ntt.co.jp (Postfix) with ESMTP id BE02E104001; Mon, 26 May 2008 20:29:47 +0900 (JST) Date: Mon, 26 May 2008 20:30:00 +0900 From: ITAGAKI Takahiro To: Albert Cervera Areny Subject: Re: Posible planner improvement? Cc: pgsql-performance@postgresql.org In-Reply-To: <200805211228.48248.albert@sedifa.com> References: <200805211228.48248.albert@sedifa.com> Message-Id: <20080526201825.C96D.52131E4D@oss.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.44 [ja] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/330 X-Sequence-Number: 30298 Hello Albert, 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? Regards, --- ITAGAKI Takahiro NTT Open Source Software Center