I have a SQL query I am running, but it is experiencing significant slowdown. The main table - has over 1 million records and a unique key of cusID. It has a one to many relationship with the other two tables mentioned. The query code is as follows:
Select customer.cusID,customer.VisitDate, Customer.ExitDate, Customerchrgs.chrgsDate,
mainCharge.cpt_code,
mainCharge.chrgs_code,
Customer.cust_type
from customer, Customerchrge, mainCharge
where ((customer.VisitDate >= 20080318) and
(Customer.ExitDate <= 20080418))
and
((Customer.cusID = Customerchrgs.cusID) and
(Customer.cusID = mainCharge.cusID));
customer index= cusID
mainCharge index = CusID + SeqNo
Customerchrgs = CusID + SeqNo
Why might the peformance of this query be so poor?
Software/Hardware used:
ASKED:
October 23, 2008 6:22 PM
UPDATED:
October 24, 2008 12:45 AM