Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
If you can't
login and post questions or you are having trouble viewing forum posts:
Click Here
|
Callback
Support |
If you live in USA, UK, Canada, Australia or New
Zealand, you can leave us details on your question and request us to call you back and discuss
them with you personally (charges apply). |
Click Here
|
Buy Support
Incidents |
If you can't find your answer
in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us
private or confidential information: |
Click Here
|
|
Slow Query Processing using QODBC |
Author |
Message |
|
Posted : 2008-08-26 23:45:17 |
Hi All,
I have Access application which uses pass through query as shown below.
SELECT
SalesOrderLine.SalesOrderLineItemRefFullName AS Item, SalesOrderLine.CustomFieldSalesOrderLineDATEDUE AS DueDate, SalesOrderLine.SalesOrderLineQuantity-SalesOrderLine.SalesOrderLineInvoiced AS QuantityDue, SalesOrderLine.RefNumber AS OrderNumber, SalesOrderLine.CustomerRefFullName AS Customer, SalesOrderLine.PONumber, ItemInventory.QuantityOnHand AS IOnHand FROM {IJ SalesOrderLine UNOPTIMIZED INNER JOIN ItemInventory UNOPTIMIZED On SalesOrderLine.SalesOrderLineItemRefFullName=ItemInventory.FullName} WHERE (SalesOrderLine.CustomFieldSalesOrderLineDATEDUE <= {fn CONVERT( ({fn TIMESTAMPADD(SQL_TSI_DAY,14,{fn CURDATE()} )}),SQL_VARCHAR)}) OR (SalesOrderLine.CustomFieldSalesOrderLineDATEDUE is Null)
When we run above query it took around 6 minutes to run the equerry; “SalesOrderLine” table has just 750 records. If we run this query in optimized mode query shows “CustomFieldSalesOrderLineDATEDUE” as blank as this is custom field. Also optimized mode query took around same time as in unoptimized mode. We set “Use Optimizer” on and “start of every new connection (with Load Updated Data first)” was selected.
We would really appreciate any suggestions to improve the speed of the query.
Sincerely, Clifford
|
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2008-08-27 08:30:25 |
The use of {fn CONVERT( ({fn TIMESTAMPADD(SQL_TSI_DAY,14,{fn CURDATE()} )}),SQL_VARCHAR)}) causes the where statement to be evaluated and a full table scan to run slowing the query. This is due to a cast error bug within QODBC, the value needs to be absolute.
See: Updating data in Crystal Reports - optimization settings? for more background on this. |
|
|
|
|