Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 3B238633FC3 for ; Wed, 1 Apr 2009 14:19:15 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 72560-04 for ; Wed, 1 Apr 2009 14:19:10 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 249FB6336C7 for ; Wed, 1 Apr 2009 14:19:11 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n31HJADx007885; Wed, 1 Apr 2009 13:19:10 -0400 (EDT) To: Rikard Pavelic cc: pgsql-performance@postgresql.org Subject: Re: self join revisited In-reply-to: <49D3969F.4030701@zg.htnet.hr> References: <49D3969F.4030701@zg.htnet.hr> Comments: In-reply-to Rikard Pavelic message dated "Wed, 01 Apr 2009 18:30:23 +0200" Date: Wed, 01 Apr 2009 13:19:10 -0400 Message-ID: <7884.1238606350@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.059 tagged_above=0 required=5 tests=AWL=0.059 X-Spam-Level: X-Archive-Number: 200904/20 X-Sequence-Number: 33387 Rikard Pavelic writes: > It would be great if Postgres could rewrite this query AFAICS those queries are not going to produce the same results, so Postgres would be 100% incorrect to rewrite it like that for you. (If they do produce the same results, it would depend on a bunch of assumptions you have not stated.) regards, tom lane