Received: from localhost (unknown [200.46.204.183]) by developer.postgresql.org (Postfix) with ESMTP id C9CC42E0071 for ; Thu, 19 Jun 2008 10:47:00 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 71421-03-5 for ; Thu, 19 Jun 2008 10:46:46 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from gwmta.wicourts.gov (gwmta.wicourts.gov [165.219.244.99]) by developer.postgresql.org (Postfix) with ESMTP id 4C73B2E008A for ; Thu, 19 Jun 2008 10:46:44 -0300 (ADT) Received: from Courts-MTA by gwmta.wicourts.gov with Novell_GroupWise; Thu, 19 Jun 2008 08:46:40 -0500 Message-Id: <485A1CA6.EE98.0025.0@wicourts.gov> X-Mailer: Novell GroupWise Internet Agent 7.0.3 Date: Thu, 19 Jun 2008 08:46:26 -0500 From: "Kevin Grittner" To: "Daniele Varrazzo" , Subject: Re: An "obvious" index not being used References: <4859B13F.3070103@develer.com> In-Reply-To: <4859B13F.3070103@develer.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/99 X-Sequence-Number: 30449 >>> Daniele Varrazzo wrote: > select count(*) from foo > where foo.account_id in ( > select id from accounts where system = 'abc'); > Total runtime: 13412.226 ms Out of curiosity, how does it do with the logically equivalent?: select count(*) from foo where exists (select * from accounts where accounts.id = foo.account_id and accounts.system = 'abc'); -Kevin