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
|
|
problematic query |
Author |
Message |
amir |
|
Group | : Members |
Posts | : 9 |
Joined | : 2006-08-17 |
|
Profile |
|
Posted : 2006-12-28 00:56:48 |
Hi,
I have performance problems with a query:
select listid,name,QuantityOnHand from iteminventory where isactive=1 and PurchaseCost>0
The query takes a very long time about 30 sec until the first row comes, and extra time on every 100 records fetch.
The same query without the QuantityOnHand field takes nothing including fetching all the records:
select listid,namefrom iteminventory where isactive=1 and PurchaseCost>0
Can I improve some how the first query?
Is there alternative (fast) way to fetch all the items QuantityOnHand ?
Amir
|
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-12-28 20:41:46 |
The use of the QuantityOnHand column requires us to retreive the values directly out of QuickBooks in real time instead of using our optimizer. If you're happy you haven't changed QuantityOnHand, then you can bypass syncing with QuickBooks by doing this instead:
select listid,name,QuantityOnHand from iteminventory NOSYNC where isactive=1 and PurchaseCost>0
To resync the table run the following SQL statement:
sp_optimizefullsync iteminventory
See: How do I setup the QODBC Optimizer? Where are the Optimizer options? for more. |
|
|
|
amir |
|
Group | : Members |
Posts | : 9 |
Joined | : 2006-08-17 |
|
Profile |
|
Posted : 2006-12-29 00:59:00 |
Hi,
First thanks for the fast reply.
I took your advice and now I execute the query:
sp_optimizeupdatesync iteminventory
and then execute the next query:
select listid,name,QuantityOnHand from iteminventory NOSYNC where isactive=1 and PurchaseCost>0
To check that every things work I inserted manually 2 orders into QB with products ( active products with PurchaseCost>0) with quantity 4 and 3,
Then I ran the queries but the orders products QuantityOnHand is still showing the old QuantityOnHand.
By the way the QODBC use optimizer is checked
with the radio button on “The start of every query”
Please advise
Amir |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2006-12-29 11:34:23 |
If you're happy you haven't changed QuantityOnHand, then you can bypass syncing with QuickBooks by using the NOSYNC tag in the query. But here you are changing the QuantityOnHand so you will need to put up with the delay in running:
select listid,name,QuantityOnHand from iteminventory where isactive=1 and PurchaseCost>0
against QuickBooks in real time or resync the table again after the change by running:
sp_optimizefullsync iteminventory
or you can experiment using this instead:
select listid,name,QuantityOnHand from iteminventory VERIFY where isactive=1 and PurchaseCost>0
The problem here is that when QuickBooks modifies the QuantityOnHand it doesn't change the modified timestamp of the inventory record, so we can't detect the change..... that's why QODBC will forcible read the QuantityOnHand value directly from QuickBooks, which is slower. |
|
|
|
amir |
|
Group | : Members |
Posts | : 9 |
Joined | : 2006-08-17 |
|
Profile |
|
Posted : 2006-12-31 23:32:12 |
Hi,
I understand what you saying. You are saying that you 'can't detect the change' of QuantityOnHand so my adivse for you on how you can improve your QODBC algorithm is:-
Update the items that have inventory transaction with date after the item inventory stored date (global stock last change date from last scan such as from the table InventoryAdjustment field TimeModified ).
And that’s how you can detect the change.
Amir |
|
|
|
Tom |
|
Group | : Administrator |
Posts | : 5510 |
Joined | : 2006-02-17 |
|
Profile |
|
Posted : 2007-01-01 04:34:17 |
Thank you, I will pass on your suggestion. |
|
|
|
|