Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 1A7BB633A08 for ; Fri, 19 Mar 2010 16:49:38 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 20363-05 for ; Fri, 19 Mar 2010 19:49:21 +0000 (UTC) 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 mail.postgresql.org (Postfix) with ESMTP id 3B801633837 for ; Fri, 19 Mar 2010 16:49:25 -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 o2JJnMar005136; Fri, 19 Mar 2010 15:49:22 -0400 (EDT) To: Alexandre de Arruda Paes cc: pgsql-performance@postgresql.org Subject: Re: PG using index+filter instead only use index In-reply-to: References: Comments: In-reply-to Alexandre de Arruda Paes message dated "Fri, 19 Mar 2010 10:45:50 -0300" Date: Fri, 19 Mar 2010 15:49:22 -0400 Message-ID: <5135.1269028162@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.461 tagged_above=-10 required=5 tests=AWL=0.138, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/246 X-Sequence-Number: 38071 Alexandre de Arruda Paes writes: > My question: if the cost is exactly the same, why PG choose the index > ict13t2 on ct13t and apply a filter instead use the primary key ? Why shouldn't it, if the estimated costs are the same? You didn't actually demonstrate they're the same though. The cost estimates look a bit unusual to me; are you using nondefault cost parameters, and if so what are they? regards, tom lane