Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> ** SQL tuning question
Hi,
I have a query joining three tables similar to the following :
select c.cust_name, o.order_number, ro1.related_order_number from order o, customer c, rel_orders ro1
where c.cust_id = o.cust_id and c.cust_type = 'OV' and o.order_number = ro1.order_number and ro1.related_order_number in (select ro2.related_order_number from rel_orders ro2 where ro2.order_number = :v_order_number)
Tables order and customer are huge (millions) and rel_orders is very small (hundreads). I would like the optimizer to go to the small table first then get the order_number and go to orders table which has index on order_number and then go to cust table with cust_id(indexed). I tried the hint /*+ ordered (ro2 ro1 o c) */ but it does not help. I even tried to give the index hint for bigger tables but that does not help. it either does full table scan or index_full_scan. I tried several ways of writing the query but it does not help. I tried without the condition : and c.cust_type = 'OV'. No use. Please note that there can be more than one related_order_number for a order_number. Has someone encountered a similar case and can someone help. Thanks.
-- Archives are at http://www.freelists.org/archives/oracle-l/ FAQ is at http://www.freelists.org/help/fom-serve/cache/1.htmlReceived on Mon Mar 01 2004 - 16:29:59 CST
-----------------------------------------------------------------
![]() |
![]() |