Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Any way to speed this up?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01265099
Message ID:
01265107
Vues:
8
>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
>
>TIA,
>Mike

EMPTY function is not optimizable. You may want to change it to date = {}, String =="", etc. instead to get Rushmore to kick in. But with OR condition it's hard to achieve good performance anyway.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform