Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 9D8A09FA6AE for ; Sun, 28 Oct 2007 20:45:26 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 63224-05 for ; Sun, 28 Oct 2007 20:45:14 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 9E0F99FA547 for ; Sun, 28 Oct 2007 20:45:18 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l9SNjE6I010340; Sun, 28 Oct 2007 19:45:14 -0400 (EDT) To: Sami Dalouche cc: pgsql-performance@postgresql.org Subject: Re: Outer joins and Seq scans In-reply-to: <1193612147.9809.13.camel@samlaptop> References: <1193606710.9008.12.camel@samlaptop> <8688.1193609314@sss.pgh.pa.us> <1193612147.9809.13.camel@samlaptop> Comments: In-reply-to Sami Dalouche message dated "Sun, 28 Oct 2007 23:55:46 +0100" Date: Sun, 28 Oct 2007 19:45:14 -0400 Message-ID: <10339.1193615114@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200710/338 X-Sequence-Number: 27360 Sami Dalouche writes: > So, the version of postgres I use is : > samokk@samlaptop:~/Desktop $ dpkg -l | grep postgres > ii postgresql-8.2 8.2.5-1.1 OK. I think you have run afoul of a bug that was introduced in 8.2.5 that causes it not to realize that it can interchange the ordering of certain outer joins. Is there any chance you can apply the one-line patch shown here: http://archives.postgresql.org/pgsql-committers/2007-10/msg00374.php If rebuilding packages is not to your taste, possibly a down-rev to 8.2.4 would be the easiest solution. regards, tom lane