L
LDA via AccessMonster.com
hello,
Below is an example of my SQL.
Currenlty it is taking the query over 5 minutes to Load (if it decides to do
such)
I read some other blogs which indicating optimizing the speed of the query by
assigning relationships/indexes.
I have done all that I know to do. Is this query running slow/timing out
because of the number of fields?
How could I improve the speed.
Thanks,
LDA
SELECT DISTINCT Results.OrderID, SampleDetails.Matrix, Customers.CustomerName,
Results.Test, Results.Param, SampleDetails.Priority, Results.SampleNumber,
SampleDetails.AnalysisEmployee, Tests.Cost, Priorities.PriceMultiplier,
Duke_OrderInfo.SampleType, Duke_OrderInfo.StatCode, Results.Method,
TestPrices.Price, Results.Report, duke_accounting_testcharge1.singleprice,
IIf([singleprice]=False,[TestPrices].[Price]*[PriceMultiplier]*Count([Param]),
[TestPrices].[Price]*[PriceMultiplier]) AS charge, Results.orderid, Count
(Results.param) AS CountOfparam, Results.EnteredDate
FROM (Duke_Accounting_TestCharge INNER JOIN ((((((Results INNER JOIN Orders
ON Results.OrderID = Orders.OrderID) INNER JOIN Customers ON Orders.
CustomerID = Customers.CustomerID) INNER JOIN SampleDetails ON (Results.
OrderID = SampleDetails.OrderID) AND (Results.SampleNumber = SampleDetails.
SampleNumber) AND (Results.Test = SampleDetails.Test)) INNER JOIN (Tests
INNER JOIN TestPrices ON (Tests.Method = TestPrices.Method) AND (Tests.Test =
TestPrices.Test)) ON (SampleDetails.Test = Tests.Test) AND (SampleDetails.
Matrix = Tests.Matrix)) INNER JOIN Priorities ON SampleDetails.Priority =
Priorities.Priority) INNER JOIN Duke_OrderInfo ON Results.OrderID =
Duke_OrderInfrderID) ON Duke_Accounting_TestCharge.Test = Tests.Test)
INNER JOIN duke_accounting_testcharge1 ON (Priorities.Priority =
duke_accounting_testcharge1.Priority) AND (Duke_Accounting_TestCharge.Test =
duke_accounting_testcharge1.Test)
GROUP BY Results.OrderID, SampleDetails.Matrix, Customers.CustomerName,
Results.Test, Results.Param, SampleDetails.Priority, Results.SampleNumber,
SampleDetails.AnalysisEmployee, Tests.Cost, Priorities.PriceMultiplier,
Duke_OrderInfo.SampleType, Duke_OrderInfo.StatCode, Results.Method,
TestPrices.Price, Results.Report, duke_accounting_testcharge1.singleprice,
Results.orderid, Results.EnteredDate
HAVING (((Results.Method) Not Like "V_*") AND ((Results.Report)=True))
ORDER BY Results.SampleNumber;
Below is an example of my SQL.
Currenlty it is taking the query over 5 minutes to Load (if it decides to do
such)
I read some other blogs which indicating optimizing the speed of the query by
assigning relationships/indexes.
I have done all that I know to do. Is this query running slow/timing out
because of the number of fields?
How could I improve the speed.
Thanks,
LDA
SELECT DISTINCT Results.OrderID, SampleDetails.Matrix, Customers.CustomerName,
Results.Test, Results.Param, SampleDetails.Priority, Results.SampleNumber,
SampleDetails.AnalysisEmployee, Tests.Cost, Priorities.PriceMultiplier,
Duke_OrderInfo.SampleType, Duke_OrderInfo.StatCode, Results.Method,
TestPrices.Price, Results.Report, duke_accounting_testcharge1.singleprice,
IIf([singleprice]=False,[TestPrices].[Price]*[PriceMultiplier]*Count([Param]),
[TestPrices].[Price]*[PriceMultiplier]) AS charge, Results.orderid, Count
(Results.param) AS CountOfparam, Results.EnteredDate
FROM (Duke_Accounting_TestCharge INNER JOIN ((((((Results INNER JOIN Orders
ON Results.OrderID = Orders.OrderID) INNER JOIN Customers ON Orders.
CustomerID = Customers.CustomerID) INNER JOIN SampleDetails ON (Results.
OrderID = SampleDetails.OrderID) AND (Results.SampleNumber = SampleDetails.
SampleNumber) AND (Results.Test = SampleDetails.Test)) INNER JOIN (Tests
INNER JOIN TestPrices ON (Tests.Method = TestPrices.Method) AND (Tests.Test =
TestPrices.Test)) ON (SampleDetails.Test = Tests.Test) AND (SampleDetails.
Matrix = Tests.Matrix)) INNER JOIN Priorities ON SampleDetails.Priority =
Priorities.Priority) INNER JOIN Duke_OrderInfo ON Results.OrderID =
Duke_OrderInfrderID) ON Duke_Accounting_TestCharge.Test = Tests.Test)
INNER JOIN duke_accounting_testcharge1 ON (Priorities.Priority =
duke_accounting_testcharge1.Priority) AND (Duke_Accounting_TestCharge.Test =
duke_accounting_testcharge1.Test)
GROUP BY Results.OrderID, SampleDetails.Matrix, Customers.CustomerName,
Results.Test, Results.Param, SampleDetails.Priority, Results.SampleNumber,
SampleDetails.AnalysisEmployee, Tests.Cost, Priorities.PriceMultiplier,
Duke_OrderInfo.SampleType, Duke_OrderInfo.StatCode, Results.Method,
TestPrices.Price, Results.Report, duke_accounting_testcharge1.singleprice,
Results.orderid, Results.EnteredDate
HAVING (((Results.Method) Not Like "V_*") AND ((Results.Report)=True))
ORDER BY Results.SampleNumber;