Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id 10A7B2E002C for ; Wed, 21 May 2008 07:35:46 -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 07014-06 for ; Wed, 21 May 2008 07:35:35 -0300 (ADT) X-Greylist: delayed 00:06:41.085503 by SQLgrey-1.7.6 Received: from mails1.interdominios.com (mails1.interdominios.com [89.248.97.42]) by developer.postgresql.org (Postfix) with ESMTP id 120B22E005A for ; Wed, 21 May 2008 07:35:36 -0300 (ADT) Received: (qmail 8104 invoked from network); 21 May 2008 12:28:53 +0200 Received: from www.sedifa.com (HELO sardina) (83.175.220.10) by sysarquitectura.com with SMTP; 21 May 2008 12:28:53 +0200 From: Albert Cervera Areny Organization: Sedifa, S.L. To: pgsql-performance@postgresql.org Subject: Posible planner improvement? Date: Wed, 21 May 2008 12:28:47 +0200 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200805211228.48248.albert@sedifa.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/285 X-Sequence-Number: 30253 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; The change is pretty simple and it seems (note I don't have a clue on how the planner works) it'd be possible for the planner to make this assumption itself. Do you think it is really feasible/appropiate?