pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Daniele Varrazzo <piro@develer.com>
To: pgsql-performance@postgresql.org
Subject: Re: An "obvious" index not being used
Date: Thu, 19 Jun 2008 08:46:26 -0500
Message-ID: <485A1CA6.EE98.0025.0@wicourts.gov> (raw)
In-Reply-To: <4859B13F.3070103@develer.com>
References: <4859B13F.3070103@develer.com>

>>> Daniele Varrazzo <piro@develer.com> 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



view thread (9+ messages)  latest in thread

Message-ID: <485A1CA6.EE98.0025.0@wicourts.gov>
Permalink:  ../485A1CA6.EE98.0025.0@wicourts.gov/
Also on:    postgresql.org/message-id/485A1CA6.EE98.0025.0@wicourts.gov

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, piro@develer.com
  Subject: Re: An "obvious" index not being used
  In-Reply-To: <485A1CA6.EE98.0025.0@wicourts.gov>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox