Re: IN vs EXIIST

From: Jean-Luc Lachance <jllachan(at)nsd(dot)ca>
To: Darren Ferguson <darren(at)crystalballinc(dot)com>
Cc: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: IN vs EXIIST
Date: 2002-09-19 17:57:14
Message-ID: 3D8A0FFA.B1FEF32A@nsd.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

This is not what he wants.

He wants all keys that have only true for x.


> Why areyou using the sub select. If you just want all the key1 where x is
> true then the following will work
>
> SELECT DISTINCT(key1) FROM a WHERE x = TRUE;
>
> If you want all rows and don't care about duplicates then remove the
> distinct.
>
> Hope this helps
>
> >
> > I've seen many posts saying that using IN is not optimal and replacing
> > it with EXISTS is much better. I've read the only docs but I can't
> > understand the difference between the two or how to convert.
> >
> > Can someone point me to some other docs or explain to me how to convert?
> > Or is my table schema wrong?
> >
> > Thanks!
> >
> > Jc
> >

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jean-Luc Lachance 2002-09-19 18:08:27 Re: IN vs EXIIST
Previous Message Stephan Szabo 2002-09-19 17:54:49 Re: cascade problems