Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 17F3DB5DBC1 for ; Fri, 10 Jun 2011 08:23:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 84258-05 for ; Fri, 10 Jun 2011 11:22:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from elizabeth.gransy.com (elizabeth.gransy.com [89.187.132.199]) by mail.postgresql.org (Postfix) with ESMTP id 1BCBDB5DBC4 for ; Fri, 10 Jun 2011 08:22:58 -0300 (ADT) Received: from sq.gransy.com (localhost [127.0.0.1]) by elizabeth.gransy.com (Postfix) with ESMTP id F2A4815E40C4; Fri, 10 Jun 2011 13:22:57 +0200 (CEST) Received: from 85.161.57.44 (SquirrelMail authenticated user tv@fuzzy.cz) by sq.gransy.com with HTTP; Fri, 10 Jun 2011 13:22:58 +0200 Message-ID: <9f040b694b5b87c5ab1754b37e367e10.squirrel@sq.gransy.com> In-Reply-To: <201106101838.39781.anthony.shipman@symstream.com> References: <201106071802.08272.anthony.shipman@symstream.com> <201106081834.07263.anthony.shipman@symstream.com> <201106101838.39781.anthony.shipman@symstream.com> Date: Fri, 10 Jun 2011 13:22:58 +0200 Subject: Re: strange query plan with LIMIT From: tv@fuzzy.cz To: anthony.shipman@symstream.com Cc: tv@fuzzy.cz, pgsql-performance@postgresql.org, "Claudio Freire" , "Pavel Stehule" User-Agent: SquirrelMail/1.4.21 MIME-Version: 1.0 Content-Type: text/plain;charset=utf-8 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/112 X-Sequence-Number: 44045 > If I had set the primary key to (diag_id, create_time) would simple > queries on > diag_id still work well i.e. > select * from tdiag where diag_id = 1234; Yes. IIRC the performance penalty for using non-leading column of an index is negligible. But why don't you try that on your own - just run an explain and you'll get an immediate answer if that works. regards Tomas