Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 083FE63418C for ; Mon, 23 Aug 2010 11:39:25 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 42970-05-2 for ; Mon, 23 Aug 2010 14:39:16 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from spinlock.commandprompt.com (unknown [207.173.203.215]) by mail.postgresql.org (Postfix) with ESMTP id 6EDCA63325D for ; Mon, 23 Aug 2010 11:39:16 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by spinlock.commandprompt.com (Postfix) with ESMTP id 8A53B348034; Mon, 23 Aug 2010 07:38:48 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at commandprompt.com Received: from spinlock.commandprompt.com ([127.0.0.1]) by localhost (spinlock.commandprompt.com.commandprompt.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id N7+WRaiPXVop; Mon, 23 Aug 2010 07:38:41 -0700 (PDT) Received: from perhan.alvh.no-ip.org (200-85-200-241.bk3-dsl.surnet.cl [200.85.200.241]) by spinlock.commandprompt.com (Postfix) with ESMTPSA id 23129348002; Mon, 23 Aug 2010 07:38:41 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id C5D6F6E50D; Mon, 23 Aug 2010 10:38:35 -0400 (CLT) Content-Type: text/plain; charset=UTF-8 Cc: pgsql-performance Subject: Re: Inefficient query plan From: Alvaro Herrera To: =?utf-8?q?Jann_R=C3=B6der?= In-reply-to: References: Date: Mon, 23 Aug 2010 10:38:35 -0400 Message-Id: <1282574235-sup-6539@alvh.no-ip.org> User-Agent: Sup/git Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.107 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RDNS_NONE=0.793 X-Spam-Level: X-Archive-Number: 201008/260 X-Sequence-Number: 40103 Excerpts from Jann Röder's message of lun ago 23 00:23:38 -0400 2010: > "Hash Join (cost=516.66..17710110.47 rows=8358225 width=16)" > " Hash Cond: ((b.itemid)::bpchar = a.itemid)" > " -> Seq Scan on b (cost=0.00..15110856.68 rows=670707968 width=16)" > " -> Hash (cost=504.12..504.12 rows=1003 width=16)" > " -> Index Scan using idx_issueid on a (cost=0.00..504.12 > rows=1003 width=16)" > " Index Cond: (issueid = 'A1983PW823'::bpchar)" Hmm, I'm placing bets on the bpchar weirdness. I'd try getting rid of that and using plain varchar for all the columns. -- Álvaro Herrera The PostgreSQL Company - Command Prompt, Inc. PostgreSQL Replication, Consulting, Custom Development, 24x7 support