Re: IN vs EXISTS

From: askel <dummy666(at)mail(dot)ru>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: IN vs EXISTS
Date: 2008-06-09 14:14:59
Message-ID: 93a79e8c-e923-4a80-b373-bca674a3a464@z72g2000hsb.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tom,

I'm using 8.3.1. I did run EXPLAIN but have never familiarized myself
with how to read/use it beside simple comparing cost estimation and
whether there is any seq scan that can benefit from creating index.

Thanks for replying

On Jun 7, 11:19 am, t(dot)(dot)(dot)(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane) wrote:
> askel <dummy(dot)(dot)(dot)(at)mail(dot)ru> writes:
> > Performance is at least few times better when EXISTS is used.
>
> It really shouldn't be. PG knows more possible plans for IN than
> EXISTS, so IN should pretty much always be equal or better ... unless
> the planner is making the wrong choice. I speculate that you have
> out-of-date statistics or some such. Have you compared EXPLAIN ANALYZE
> output for the two cases? Which PG version are we talking about?
>
> regards, tom lane
>
> --
> Sent via pgsql-general mailing list (pgsql-gene(dot)(dot)(dot)(at)postgresql(dot)org)
> To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-general

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2008-06-09 14:41:16 Re: nested view with outer joins - best practices
Previous Message Bohdan Linda 2008-06-09 13:28:25 nested view with outer joins - best practices