Title: Message
My view is...
 
You can either have
 
    Select ..blah..blah..blah...where col = 'A'
    OR col='B'
    OR col='c'
 
also, you can wrtie..
 
    Select...blah..blah..blah....where col='A'
    union
    select...blah..blah..blah...where col='B'
    union
    select...blah..blah.blah..where col='C'
 
Or better.
 
    Select ...blah..blah..blah....where col in ('A','B','C') ; (with proper index in 'col')
 
Its really upto you.
 
-Arun.
----- Original Message -----
Sent: Tuesday, June 24, 2003 11:25 AM
Subject: RE: OR Vs UNION

IMHO ...
 
Cannot be.. the Access Path Taken is Different.. "OR" is Transfered to Inlist Iterator usually ...
 
Best Regards,
Ganesh R
DID : +65-6215-8413
HP  : +65-9067-8474
===========================================
Live to learn... forget... and learn again.
===========================================
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jamadagni, Rajendra
Sent: Tuesday, June 24, 2003 11:10 PM
To: Multiple recipients of list ORACLE-L
Subject: RE: OR Vs UNION

I believe OR is internally transformed to UNION (or UNION ALL) ??

The answer you are looking is ... test and measure it in _your_ _environment_.

Raj
--------------------------------------------------------------------------------
Rajendra dot Jamadagni at nospamespn dot com
All Views expressed in this email are strictly personal.
QOTD: Any clod can have facts, having an opinion is an art !

>----- ------- Original Message ------- -----
>From: [EMAIL PROTECTED]
>To: Multiple recipients of list ORACLE-L
><[EMAIL PROTECTED]>
>Sent: Mon, 23 Jun 2003 21:34:52
>
>
>
>
>
>Hi All,
>
>Could someone explain to me which one is best in
>the following two queries
>w.r.t performance?
>
>Thanks
>Sami
>
>Query1)
>========
>select distinct empployee_id from employees where
>department_id=10 or
>department_id=20
>/
>
>Query2)
>=======
>select employee_id from employees where
>department_id=10
>union
>select employee_id from employees where
>department_id=20
>/
>

Reply via email to