Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 75D78633090 for ; Mon, 23 Aug 2010 07:25:13 -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 19690-07 for ; Mon, 23 Aug 2010 10:25:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id C604463274B for ; Mon, 23 Aug 2010 07:25:05 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OnUDA-0006NG-CL for pgsql-performance@postgresql.org; Mon, 23 Aug 2010 12:25:04 +0200 Received: from 178-83-162-123.dclient.hispeed.ch ([178.83.162.123]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 23 Aug 2010 12:25:04 +0200 Received: from roederja by 178-83-162-123.dclient.hispeed.ch with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 23 Aug 2010 12:25:04 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-performance@postgresql.org From: =?UTF-8?B?SmFubiBSw7ZkZXI=?= Subject: Re: Inefficient query plan Date: Mon, 23 Aug 2010 12:20:02 +0200 Lines: 23 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 178-83-162-123.dclient.hispeed.ch User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; de; rv:1.9.2.8) Gecko/20100802 Thunderbird/3.1.2 In-Reply-To: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201008/251 X-Sequence-Number: 40094 Am 23.08.10 12:18, schrieb Scott Marlowe: > On Mon, Aug 23, 2010 at 4:15 AM, Jann Röder wrote: >> Am 23.08.10 07:52, schrieb Scott Marlowe: >>> Also are a.indexid and b.indexid the same type? >>> >> >> You mean ItemID? Fields of the same name are of the same type - so yes. >> According to the documentation pgsql adds indexes for primary keys >> automatically so (b.itemID, b.indexNumber) is indexed. Or do you think >> adding an extra idnex for b.itemID alone will help? If I understand the >> documentation correctly, pqSQL can use the first column of a >> multi-column index as if it was indexed individually... but maybe I'm >> wrong here. > > It can but that doesn't mean it will. A multi-column index is often > quite a bit bigger than a single column one. > > What happens if you try > > set enable_seqscan=off; > (your query here) > Tried that already. The query plan is exactly the same.