Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Problems with OR in Oracle 8i
Hi All,
I have a fairly big Oracle 8i database (2 million order rows in the largest table) and I'm having trouble with the OR operator in a query. For some reason the OR is causing queries to run dog slow. It's so slow that I have to take out the OR and use a UNION instead. For example:
this takes 5 minutes to run:
select * from sales_order, customer where customer.customer_code=sales_order.customer_code and salesmen1='person1' or salesmen2='person1'
this takes a few seconds to run and returns the same result:
select * from sales_order, customer where customer.customer_code=sales_order.customer_code and salesmen1='person1'
union
select * from sales_order, customer where
customer.customer_code=sales_order.customer_code and salesmen2='person1'
Almost every time I use an OR on a moderately complex query on a big table the thing takes forever. Is there a problem with the 8i optomizer? These unions get cumbersome, especially if there are lot's of OR conditions to account for.
Thanks,
Dan
Received on Wed Jan 04 2006 - 09:46:28 CST
![]() |
![]() |