Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 93D3037B9B1 for ; Mon, 29 Sep 2008 13:42:12 -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 83071-07 for ; Mon, 29 Sep 2008 13:42:05 -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 postgresql.org (Postfix) with ESMTP id B9B3037BCA1 for ; Mon, 29 Sep 2008 13:42:02 -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 m8TGg1E9015192; Mon, 29 Sep 2008 12:42:01 -0400 (EDT) To: Doug Eck cc: pgsql-performance@postgresql.org Subject: Re: Identical DB's, different execution plans In-reply-to: <926018.53635.qm@web45204.mail.sp1.yahoo.com> References: <926018.53635.qm@web45204.mail.sp1.yahoo.com> Comments: In-reply-to Doug Eck message dated "Mon, 29 Sep 2008 09:00:02 -0700" Date: Mon, 29 Sep 2008 12:42:01 -0400 Message-ID: <15191.1222706521@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200809/265 X-Sequence-Number: 31578 Doug Eck writes: > Any ideas as to what could the first db to opt for the slower subquery rather than the merge? Not from the information given. Presumably db1 thinks that the mergejoin plan would be slower, but why it thinks that isn't clear yet. Try setting enable_nestloop = off (and enable_hashjoin = off if it then wants a hashjoin) and then post the EXPLAIN ANALYZE results. regards, tom lane