Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 2D460633180 for ; Mon, 23 Aug 2010 07:16:12 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 99833-03-5 for ; Mon, 23 Aug 2010 10:16:01 +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 5F1CE634050 for ; Mon, 23 Aug 2010 07:15:55 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OnU4H-0000mw-8q for pgsql-performance@postgresql.org; Mon, 23 Aug 2010 12:15:53 +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:15:53 +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:15:53 +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:15:43 +0200 Lines: 16 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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/249 X-Sequence-Number: 40092 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. >> I have two tables: >> A: ItemID (PK), IsssueID (Indexed) >> B: ItemID (FK), IndexNumber : PK(ItemID, IndexNumber)