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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: RE: OR Vs UNION

Re: RE: OR Vs UNION

From: <rgaffuri_at_cox.net>
Date: Tue, 24 Jun 2003 09:20:02 -0700
Message-ID: <F001.005B8892.20030624085923@fatcity.com>


the algorithm for 'or' is simply a series of key value searches right that is short circuited right?

oracle searches to see if the first value exists, if it does, stop, else look for the second value.

then turns that into a resultset correct?
>
> From: "Ganesh Raja" <[EMAIL PROTECTED]>
> Date: 2003/06/24 Tue PM 12:25:02 EDT
> To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
> 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-----
> Jamadagni, Rajendra
> Sent: Tuesday, June 24, 2003 11:10 PM
> To: Multiple recipients of list ORACLE-L
>
>
>
> 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
> >/
> >
>
>
>

Title: Message

<FONT face="Courier New" color=#0000ff
size=2>IMHO ...
<FONT face="Courier New" color=#0000ff
size=2> 
<FONT face="Courier New" color=#0000ff
size=2>Cannot be.. the Access Path Taken is Different.. "OR" is Transfered to Inlist Iterator usually ...
<FONT face="Courier New" color=#0000ff
size=2> 
Best Regards,Ganesh RDID : +65-6215-8413HP  :

+65-9067-8474===========================================Live to learn... 
forget... and learn
again.===========================================

  

  <FONT
  face=Tahoma size=2>-----Original Message-----From:   [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of   Jamadagni, RajendraSent: Tuesday, June 24, 2003 11:10   PMTo: Multiple recipients of list ORACLE-LSubject: 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 <FONT

  size=2>-------------------------------------------------------------------------------- 
  Rajendra dot Jamadagni at nospamespn dot com <FONT   size=2>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] <FONT
  size=2>>To: Multiple recipients of list ORACLE-L <FONT   size=2>><[EMAIL PROTECTED]> >Sent: Mon,   23 Jun 2003 21:34:52 > <FONT
  size=2>> > >
  > >Hi All, <FONT
  size=2>> >Could someone explain to me which one   is best in >the following two queries   >w.r.t performance? >
  >Thanks >Sami <FONT
  size=2>> >Query1) <FONT
  size=2>>======== >select distinct empployee_id   from employees where >department_id=10 or   >department_id=20 >/
  > >Query2) <FONT
  size=2>>======= >select employee_id from   employees where >department_id=10 <FONT
  size=2>>union >select employee_id from employees 
  where >department_id=20 <FONT 
  size=2>>/ > 
Received on Tue Jun 24 2003 - 11:20:02 CDT

Original text of this message

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