I'm running the following query against two tables residing on an Oracle 8 database.
The query takes too long (over an hour) to run. Both tables are indexed - however the main table SALES.SO is HUGE. Does anyone have any suggestions as to how I could improve this query so it can execute faster.
Here's the main part of it:
SELECT s.cust_cd, d.st, d.reg REGION
FROM SALES.SO s AND devl.tblreg d
WHERE d.st = s.store_cd
AND s.wr_dt between v_dt and v_dt+28
AND s.so_wr_dt < to_date('&e_dt')+1
AND d.reg = 'STL'
AND (s.layaway = 'N')
OR s.layaway is null)
AND s.fin_cust_cd is null
Thanks for your help.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!