Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 0D91E632525 for ; Wed, 21 Jan 2009 11:27:06 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 90182-10 for ; Wed, 21 Jan 2009 11:27:02 -0400 (AST) 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 2CEF9632512 for ; Wed, 21 Jan 2009 11:27:01 -0400 (AST) 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 n0LFPceu002117; Wed, 21 Jan 2009 10:25:38 -0500 (EST) To: Alvaro Herrera cc: Michael Monnerie , pgsql-admin@postgresql.org Subject: Re: Question on Index usage In-reply-to: <20090121142829.GE4038@alvh.no-ip.org> References: <200901210854.28091@zmi.at> <20090121142829.GE4038@alvh.no-ip.org> Comments: In-reply-to Alvaro Herrera message dated "Wed, 21 Jan 2009 11:28:29 -0300" Date: Wed, 21 Jan 2009 10:25:38 -0500 Message-ID: <2116.1232551538@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200901/91 X-Sequence-Number: 31138 Alvaro Herrera writes: > Seems like the problem is that it is not pushing the "status IN" > condition as part of the index condition for some reason, and instead > using it as a filter. Maybe something to do with the selectivity of > that clause? No, AFAIR the planner will *always* include every possibly relevant condition for a given index. If the condition is useless or nearly so, that might prompt it to pick a different index instead, but not to omit the indexqual. I'm thinking it's not believing it can use the status condition with that index, perhaps for datatype reasons. What is status declared as, exactly? Also, what PG version is this? regards, tom lane