Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: optimal sql
"Christoph Seidel" <chris666.seidel_at_gmx.de> wrote in message news:<at31k8$vtma0$1_at_ID-143718.news.dfncis.de>...
> Alex Filonov wrote:
>
> > If I understand it right, pk column is a primary key in the second
> > table as well.
>
> yes
>
> > In this case, there is no difference between not in and
> > not exists.
>
> why?
>
Because in both cases Oracle will do unique index search in subquery.
> > BTW, in some cases the most efficient statment would be:
> >
> > select * from t1
> > where t1.pk in
> > (select pk from t1
> > minus
> > select pk from t2)
>
> thx
Received on Tue Dec 10 2002 - 09:28:18 CST