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

Home -> Community -> Usenet -> c.d.o.tools -> IN vs NOT IN

IN vs NOT IN

From: <susana73_at_hotmail.com>
Date: Thu, 07 Dec 2000 17:31:56 GMT
Message-ID: <90ohic$n8h$1@nnrp1.deja.com>

Hi there,

I have 2 queries which have same logical meaning. However, the one with 'NOT IN' takes forever and the one with 'IN' takes just couple seconds. I did a EXPLAIN on them and it looks like the one with 'NOT IN' is doing a full table scan for both table that's why it takes so long. Could anyone explain to me why?

There are about 100k objectid.

Thanks in advance.

Susan

Execution Plan


   0 SELECT STATEMENT Optimizer=CHOOSE    1 0 SORT (AGGREGATE)

   2    1     FILTER
   3    2       TABLE ACCESS (FULL) OF 'STRUCT'
   4    2       TABLE ACCESS (FULL) OF 'DETAIL'

Execution Plan


   0 SELECT STATEMENT Optimizer=CHOOSE    1 0 SORT (AGGREGATE)

   2    1     NESTED LOOPS
   3    2       VIEW OF 'VW_NSO_1'
   4    3         SORT (UNIQUE)
   5    4           TABLE ACCESS (FULL) OF 'OBJECT'
   6    2       INDEX (RANGE SCAN) OF 'PKEY_STRUCT_IDX' (NON-UNIQU
          E)


Sent via Deja.com http://www.deja.com/
Before you buy. Received on Thu Dec 07 2000 - 11:31:56 CST

Original text of this message

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