Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 92BC19FA173 for ; Wed, 13 Dec 2006 15:14:43 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 56216-02 for ; Wed, 13 Dec 2006 15:14:36 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from mx2.ipf.is (scania.ipf.is [85.197.192.147]) by postgresql.org (Postfix) with ESMTP id D02C29F9F46 for ; Wed, 13 Dec 2006 15:14:37 -0400 (AST) Received: (qmail 28585 invoked by uid 1010); 13 Dec 2006 19:11:36 +0000 Received: from 88.149.106.19 by scania (envelope-from , uid 1008) with qmail-scanner-1.25-st-qms (clamdscan: 0.88/1235. spamassassin: 3.1.1. perlscan: 1.25-st-qms. Clear:RC:1(88.149.106.19):SA:0(-1.9/4.5):. Processed in 2.439354 secs); 13 Dec 2006 19:11:36 -0000 X-Antivirus-IPF-Mail-From: gnari@hive.is via scania X-Antivirus-IPF: 1.25-st-qms (Clear:RC:1(88.149.106.19):SA:0(-1.9/4.5):. Processed in 2.439354 secs Process 28578) Received: from dsl-149-106-19.hive.is (HELO ?192.168.1.33?) (88.149.106.19) by mx2.ipf.is with SMTP; 13 Dec 2006 19:11:33 +0000 Subject: Re: strange query behavior From: Ragnar To: Tim Jones Cc: pgsql-performance@postgresql.org In-Reply-To: <47668A1334CDBF46927C1A0DFEB223D39F79A5@mail.optiosoftware.com> References: <47668A1334CDBF46927C1A0DFEB223D39F79A5@mail.optiosoftware.com> Content-Type: text/plain; charset=ISO-8859-1 Date: Wed, 13 Dec 2006 19:15:11 +0000 Message-Id: <1166037311.6369.123.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.8.1 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/334 X-Sequence-Number: 22390 On miš, 2006-12-13 at 13:42 -0500, Tim Jones wrote: > 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. Possibly I need to reindex this > particular index? can you provide us with an EXPLAIN ANALYZE for these 2 cases? what version pg is this? does this happen only for a particular single value, or for any values? I assume you have ANALYZEd the table in question. gnari