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: UNION or OR in query

Re: UNION or OR in query

From: <sybrandb_at_hccnet.nl>
Date: Thu, 03 May 2007 07:03:48 +0200
Message-ID: <f6ri335l713r0fku5ebaecmjbmhuvsqqnv@4ax.com>


On Thu, 03 May 2007 00:06:25 GMT, "Dereck L. Dietz" <dietzdl_at_ameritech.net> wrote:

>In the book "Oracle SQL Tuning" by Mark Gurry there is a section on pages
>63-64 about using a UNION instead of an OR. The example given differs from
>some code I've been looking at but I was wondering if the principle still
>applied.
>
>Would the second query below be more efficient like the examples in the book
>above implied?

The answer to this question would be primarily determined by looking at EXPLAIN PLAN results.
One would assume Oracle is capable of rewriting automagically #1 to #2.
I would recommend comparing EXPLAIN PLANs if you didn't already do so.

--
Sybrand Bakker
Senior Oracle DBA
Received on Thu May 03 2007 - 00:03:48 CDT

Original text of this message

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