Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id AA4479FA4F9 for ; Wed, 12 Sep 2007 11:41:24 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 20757-03 for ; Wed, 12 Sep 2007 11:41:19 -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 15AB89FA4F0 for ; Wed, 12 Sep 2007 11:41: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 l8CEfGZE022160; Wed, 12 Sep 2007 10:41:16 -0400 (EDT) To: El-Lotso cc: pgsql-performance@postgresql.org Subject: Re: Re: 500rows = 1min/2.5k rows=20min/6K rows 2 hours and still running In-reply-to: <1189584573.13796.12.camel@neuromancer.home.net> References: <1189529868.17184.17.camel@neuromancer.home.net> <1189530143.17184.21.camel@neuromancer.home.net> <15496.1189535000@sss.pgh.pa.us> <1189563332.32450.11.camel@neuromancer.home.net> <1189584573.13796.12.camel@neuromancer.home.net> Comments: In-reply-to El-Lotso message dated "Wed, 12 Sep 2007 16:09:33 +0800" Date: Wed, 12 Sep 2007 10:41:16 -0400 Message-ID: <22159.1189608076@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/224 X-Sequence-Number: 26769 El-Lotso writes: > I'm really at my wits end here. Try to merge the multiple join keys into one, somehow. I'm not sure why the planner is overestimating the selectivity of the combined join conditions, but that's basically where your problem is coming from. A truly brute-force solution would be "set enable_nestloop = off" but this is likely to screw performance for other queries. regards, tom lane