Re: Oracle Logical Operator order of execution

From: <vitalisman_at_gmail.com>
Date: Wed, 2 Apr 2008 12:54:37 -0700 (PDT)
Message-ID: <730ec110-34ea-48c1-b485-d5f97e6b2f01@13g2000hsb.googlegroups.com>


On 1 avr, 21:05, Wally <wallyr..._at_gmail.com> wrote:
> Oracle 10g R2
> Win 2003
>
> I have a select statement which is similar to
>
> select * from test
> where
> a = v_number
> or
> b between v_date_low and v_date_high;
>
> In my database , I know for a fact that only one of these conditions
> will be true at any given time
>
> Can someone tell me if Oracle calculates the left side of the OR
> operator first or the right side because I don't want Oracle to waste
> processor cycles calculating one condition when the other is already
> true.

Are you seriously trying to reduce the CPU bandwidth used by the *condition evaluation*? (Or are you rather concerned by access paths?) Have you been able to measure this CPU consumption, even with millions of rows? Is your query run every second or something?

Whatever, I hope we can trust Oracle in not evaluating an expression of an OR-condition for a row after another expression has already been evaluated to TRUE. That looks like basic optimization. Received on Wed Apr 02 2008 - 14:54:37 CDT

Original text of this message