Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 832AB37C6BF for ; Wed, 1 Oct 2008 10:30:20 -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 91055-07 for ; Wed, 1 Oct 2008 10:30:15 -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 7524F37C6AE for ; Wed, 1 Oct 2008 10:30:15 -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 m91DUCVv008397; Wed, 1 Oct 2008 09:30:12 -0400 (EDT) To: "David logan" cc: pgsql-performance@postgresql.org Subject: Re: Mystefied at poor performance of a standard query In-reply-to: <004001c923be$d8b1f730$8a15e590$@net> References: <004001c923be$d8b1f730$8a15e590$@net> Comments: In-reply-to "David logan" message dated "Wed, 01 Oct 2008 06:11:33 -0600" Date: Wed, 01 Oct 2008 09:30:12 -0400 Message-ID: <8396.1222867812@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: 200810/5 X-Sequence-Number: 31586 "David logan" writes: > (The question is why this simple select takes me 20 minutes to run...) What have you got work_mem set to? The hash join is not going to be real fast if it has to split the join into multiple batches, so you want work_mem large enough to hold the whole inner relation. That would be at least 20MB in this example, probably quite a bit more after allowing for per-row overhead in the table. regards, tom lane