Romanichine
Programmer
Hello,
I have a query that normally takes 1 second to run but when I add an "ORDER BY" clause, it raises to 15 MINUTES!
Here is the query:
SELECT ss.srv_id, ss.service_no, Orig_pop.pop_name,
sstc.srv_type_code, ssc.Component_no, sssc.Status_Descr ,ss.Cust_Name,
ssc.Component_Descr, ssp.Name
FROM spar_services ss,spar_pop orig_pop, spar_service_type_codes sstc, spar_service_components ssc,
spar_service_status_codes sssc, spar_service_providers ssp,
spar_contracts sc, spar_services ss_parent,
spar_component_types sctc, spar_service_provider_accounts sspa, spar_pop dest_pop
WHERE ss.srv_id = ssc.srv_id
AND ssc.srv_status_id = sssc.srv_status_id (+)
AND ss.sp_id = ssp.sp_id (+)
AND ss.sp_acct_id = sspa.sp_acct_id (+)
AND ss.origin_pop_id = orig_pop.pop_id (+)
AND ss.dest_pop_id = dest_pop.pop_id (+)
AND ss.srv_type_id = sstc.srv_type_id (+)
AND ss.contract_id = sc.contract_id (+)
AND ssc.component_type_id = sctc.comp_type_id (+)
AND ss.srv_id = ss_parent.srv_id (+)
AND ss.srv_type_id <> 1
AND ss.Cust_Name LIKE('%TEST%')
ORDER BY ss.service_no, ssc.Component_no
Can anyone help?
Thanks
--
Roman
I have a query that normally takes 1 second to run but when I add an "ORDER BY" clause, it raises to 15 MINUTES!
Here is the query:
SELECT ss.srv_id, ss.service_no, Orig_pop.pop_name,
sstc.srv_type_code, ssc.Component_no, sssc.Status_Descr ,ss.Cust_Name,
ssc.Component_Descr, ssp.Name
FROM spar_services ss,spar_pop orig_pop, spar_service_type_codes sstc, spar_service_components ssc,
spar_service_status_codes sssc, spar_service_providers ssp,
spar_contracts sc, spar_services ss_parent,
spar_component_types sctc, spar_service_provider_accounts sspa, spar_pop dest_pop
WHERE ss.srv_id = ssc.srv_id
AND ssc.srv_status_id = sssc.srv_status_id (+)
AND ss.sp_id = ssp.sp_id (+)
AND ss.sp_acct_id = sspa.sp_acct_id (+)
AND ss.origin_pop_id = orig_pop.pop_id (+)
AND ss.dest_pop_id = dest_pop.pop_id (+)
AND ss.srv_type_id = sstc.srv_type_id (+)
AND ss.contract_id = sc.contract_id (+)
AND ssc.component_type_id = sctc.comp_type_id (+)
AND ss.srv_id = ss_parent.srv_id (+)
AND ss.srv_type_id <> 1
AND ss.Cust_Name LIKE('%TEST%')
ORDER BY ss.service_no, ssc.Component_no
Can anyone help?
Thanks
--
Roman