Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Any way to speed this up?
Message
From
30/10/2007 13:48:26
 
 
To
30/10/2007 13:38:56
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
01265099
Message ID:
01265108
Views:
7
>>This is part of an application originally written in vfp5; it runs slower in vfp9.
>>Any idea on how to speed it up? (All fields involved in joins, where clauses, etc. have indexes...)
>>
>>SELECT VAL(Customer.code) AS valcode, Invhead.*, Ordhead.location,;
>>  Ordhead.entered, Ordhead.priorityorder, Ordhead.customerpo,;
>>  Ordhead.daterequired, Ordhead.comm1, Ordhead.comm2, Ordhead.comm3,;
>>  Ordhead.terms, Customer.name, Customer.code, Customer.creditlmt,;
>>  Customer.einnumber, Customer.specialdisc, Customer.dollarsuse,;
>>  Ordhead.customerid, Customer.country AS custcountry,;
>>  Prodqty.totordered, Prodqty.totallocated, Prodqty.totshipped, .F. AS ok,;
>>  Rdytoship.rdytoship, Shipped.shipped, Prodqty.specialord,;
>>  ALLTRIM(STR(Ordhead.orderid))+IIF(Ordhead.sbo,"B"," ") AS dispordno,;
>>  Customer.onhold;
>> FROM ;
>>     frantisi!invhead ;
>>    INNER JOIN frantisi!ordhead ;
>>   ON  Invhead.orderid = Ordhead.orderid ;
>>    INNER JOIN frantisi!shipped ;
>>   ON  Ordhead.orderid = Shipped.orderid ;
>>    INNER JOIN frantisi!rdytoship ;
>>   ON  Invhead.invoiceno = Rdytoship.invoiceno ;
>>    INNER JOIN frantisi!customer ;
>>   ON  Customer.customerid = Ordhead.customerid ;
>>    INNER JOIN frantisi!prodqty ;
>>   ON  Ordhead.orderid = Prodqty.orderid;
>> WHERE ( ( (  EMPTY(?ldDateReqd) ;
>>   OR  Ordhead.daterequired <= ( ?ldDateReqd ) );
>>   OR  NOT (EMPTY(Invhead.picked) ) );
>>   AND  (  ( ?lnLocation ) = ( 0 );
>>   OR  Ordhead.location = ( ?lnLocation ) ) );
>>   AND  EMPTY(dispatchdate) ;
>> ORDER BY 1, Ordhead.priorityorder DESC, Invhead.invoiceno ;
>>into cursor dispatch
>>
>
>Make sure the codepage for the tables involved is the same as the codepage when you open the view. (CPDBF() = CPCURRENT())
>
>Use SYS(3054) to see how VFP is handling this query.
>
>Tamar
>> WHERE ( ( (  EMPTY(?ldDateReqd) ;
>>   OR  Ordhead.daterequired <= ( ?ldDateReqd ) );
>>   OR  NOT (EMPTY(Invhead.picked) ) );
>>   AND  (  ( ?lnLocation ) = ( 0 );
>>   OR  Ordhead.location = ( ?lnLocation ) ) );
>>   AND  EMPTY(dispatchdate) ;
Is there a reason that you are checking for such things as EMPTY(?ldDateReqd) and ?lnLocationID = 0? These are parameters that are being passed into the query, so checking their values in the query is not obvious and perhaps not neccessary...

Perhaps I am missing something...

Carsten
Carsten M. Thode
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform