Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: optimal sql

Re: optimal sql

From: Alex Filonov <afilonov_at_yahoo.com>
Date: 10 Dec 2002 07:28:18 -0800
Message-ID: <336da121.0212100728.1db906e3@posting.google.com>


"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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US