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 -> Does IN perform a implicit distinct ?

Does IN perform a implicit distinct ?

From: <bobde6_at_hotmail.com>
Date: 31 May 2005 03:57:51 -0700
Message-ID: <1117537071.774211.173060@g43g2000cwa.googlegroups.com>


Hi All

I was wondering if anybody knew if 'IN' performs a implicit distinct? For instance say if i had the query below:

select stat from orders where account_id in (select distinct account_id from accounts)

Do i need to perform a distinct lookup of the account_id ??? Is this just a duplicate - which would require an additional sort?

I have constructed a benchmark with the same value repeated in the IN caluse and I see no difference in response time / CPU time

Test 1
  select count(*) from accounts where account_id in ('15')

Test 2
  select count(*) from accounts where account_id in ('15','15','15','15','15')

Test 3
  select count(*) from accounts where account_id in   ('15','15','15','15','15','15','15','15','15','15')

Test 4
  select count(*) from accounts where account_id in   ('15','15','15','15','15','15','15','15','15','15',
'15','15','15','15','15','15','15','15','15','15',

'15','15','15','15','15','15','15','15','15','15',

'15','15','15','15','15','15','15','15','15','15',

'15','15','15','15','15','15','15','15','15','15')

Bob Received on Tue May 31 2005 - 05:57:51 CDT

Original text of this message

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