Re: Oracle Logical Operator order of execution

From: Robert Klemme <>
Date: Tue, 01 Apr 2008 21:52:15 +0200
Message-ID: <>

On 01.04.2008 21:43, Wally wrote:
> On Apr 1, 2:32 pm, hpuxrac <> wrote:
>> On Apr 1, 3:05 pm, Wally <> wrote:

>> Oracle's cost based optimizer may not look at both sides of an or and
>> there is no guarantee that it will always start on one side or the
>> other. Similarly with an "and" condition it may use one side or
>> another to use indexes and then eliminate rows after they are returned
>> as possible hits.

To make it crystal clear: database do not have boolean short circuit evaluation. A database might choose different access plans - even for the same SQL statement. Something that does not happen in programming languages (there might be special cases but the statement holds true for most modern general purpose programming languages).

Also, CPU cycles do not play the same role in a relational database as in programs. Other major factors are IO, locking etc.

>> If you are running a recent release you may want to get familiar with
>> dbms_xplan.display

Certainly good advice.

Kind regards

        robert Received on Tue Apr 01 2008 - 14:52:15 CDT

Original text of this message