B
Bill Murphy
The following query is taking about 70 seconds to run on my fast local PC.
I expected it to take 5 or 10 seconds at most. The two join fields are
indexed and each of the fields used in the criteria are indexed. The two
fields in the Order By are also indexed. tblDetail contains about 240,000
records and tblChecks contains 84,000 records. I would appreciate any
thoughts on this:
SELECT tblDetail.Date AS BankDate, tblDetail.Account,
tblDetail.Name, -[tbldetail]![amount] AS PaidAmount, tblDetail.Description,
tblDetail.BankReference, tblDetail.CustomerReference
FROM tblDetail LEFT JOIN tblChecks ON (tblDetail.Account = tblChecks.DDA)
AND (tblDetail.CustomerReference = tblChecks.CheckNumber)
WHERE
(((tblDetail.Date)<=[forms]![frmMain]![frmDisbClearingReconciliationContainer].[form]![txtReconciliationDate])
AND ((tblDetail.Account)=684968506) AND ((tblChecks.DDA) Is Null) AND
((tblChecks.CheckNumber) Is Null) AND ((tblDetail.ClearedDate) Is Null Or
(tblDetail.ClearedDate)>[forms]![frmMain]![frmDisbClearingReconciliationContainer].[form]![txtReconciliationDate])
AND ((tblDetail.UserCode)=475))
ORDER BY tblDetail.Account, tblDetail.CustomerReference;
Bill
I expected it to take 5 or 10 seconds at most. The two join fields are
indexed and each of the fields used in the criteria are indexed. The two
fields in the Order By are also indexed. tblDetail contains about 240,000
records and tblChecks contains 84,000 records. I would appreciate any
thoughts on this:
SELECT tblDetail.Date AS BankDate, tblDetail.Account,
tblDetail.Name, -[tbldetail]![amount] AS PaidAmount, tblDetail.Description,
tblDetail.BankReference, tblDetail.CustomerReference
FROM tblDetail LEFT JOIN tblChecks ON (tblDetail.Account = tblChecks.DDA)
AND (tblDetail.CustomerReference = tblChecks.CheckNumber)
WHERE
(((tblDetail.Date)<=[forms]![frmMain]![frmDisbClearingReconciliationContainer].[form]![txtReconciliationDate])
AND ((tblDetail.Account)=684968506) AND ((tblChecks.DDA) Is Null) AND
((tblChecks.CheckNumber) Is Null) AND ((tblDetail.ClearedDate) Is Null Or
(tblDetail.ClearedDate)>[forms]![frmMain]![frmDisbClearingReconciliationContainer].[form]![txtReconciliationDate])
AND ((tblDetail.UserCode)=475))
ORDER BY tblDetail.Account, tblDetail.CustomerReference;
Bill