Re: Subquery WHERE IN or WHERE EXISTS faster?

From: "Jaime Casanova" <jcasanov(at)systemguards(dot)com(dot)ec>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Ulrich <ulrich(dot)mierendorff(at)gmx(dot)net>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Subquery WHERE IN or WHERE EXISTS faster?
Date: 2008-06-30 04:33:57
Message-ID: 3073cc9b0806292133l397f0d8etef06b5bb3aba13ae@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Sat, Jun 28, 2008 at 10:53 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Ulrich <ulrich(dot)mierendorff(at)gmx(dot)net> writes:
>> People say that [EXISTS is faster]
>
> People who say that are not reliable authorities, at least as far as
> Postgres is concerned. But it is always a bad idea to extrapolate
> results on toy tables to large tables --- quite aside from measurement
> noise and caching issues, the planner might pick a different plan when
> faced with large tables. Load up a realistic amount of data and then
> see what you get.
>

i've made some queries run faster using EXISTS instead of large IN
clauses... actually, it was NOT EXISTS replacing a NOT IN

while i'm not telling EXISTS is better i actually know in some cases is better

--
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Guayaquil - Ecuador
Cel. (593) 87171157

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2008-06-30 04:48:44 Re: Subquery WHERE IN or WHERE EXISTS faster?
Previous Message Nimesh Satam 2008-06-30 04:20:15 Out of memory for Select query.