Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Slow query when using OR operater in WHERE clause

893411Jan 25 2012 — edited Jan 26 2012
Hello guys,

I have a pretty long query (3000 lines). At the end there is a WHERE clause with the following line:

(ProductNr='1111')
execution time: 10sec

When I add the an expression, that is obviously always false:
(1=2 OR ProductNr='1111')

The execution time is now 3 minutes

Do you have any idea why Oracle can't just ignore the first condition, which is always false, and takes so much longer to execute the query?

FYI: I need that condition for a reporting tool (BusinessObjects) where I added an All-Member to my list of values, which looks like 'All'=@Variable OR columnname=@variable. So the user has the possibility to chose the All-member to see the unfiltered results, or chose a specific value. Just as a backgroud information...

thanks for your help!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 23 2012
Added on Jan 25 2012
10 comments
6,108 views