Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 4F8469FA0B7 for ; Wed, 13 Dec 2006 15:16:48 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 91886-02 for ; Wed, 13 Dec 2006 15:16:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 7576F9F9F46 for ; Wed, 13 Dec 2006 15:16:35 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id kBDJGXnW010649; Wed, 13 Dec 2006 14:16:33 -0500 (EST) To: "Tim Jones" cc: pgsql-performance@postgresql.org Subject: Re: strange query behavior In-reply-to: <47668A1334CDBF46927C1A0DFEB223D39F79A5@mail.optiosoftware.com> References: <47668A1334CDBF46927C1A0DFEB223D39F79A5@mail.optiosoftware.com> Comments: In-reply-to "Tim Jones" message dated "Wed, 13 Dec 2006 13:42:20 -0500" Date: Wed, 13 Dec 2006 14:16:32 -0500 Message-ID: <10648.1166037392@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/335 X-Sequence-Number: 22391 "Tim Jones" writes: > I have a query that uses an IN clause and it seems in perform great > when there is more than two values in it but if there is only one it is > really slow. Also if I change the query to use an = instead of IN in the > case of only one value it is still slow. Please provide EXPLAIN ANALYZE output for both cases. > Possibly I need to reindex this > particular index? More likely you need to ANALYZE the table so that the planner has up-to-date stats ... regards, tom lane