Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Bad performance
Message
De
30/01/2002 08:57:12
 
 
À
29/01/2002 13:21:29
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00612305
Message ID:
00612651
Vues:
30
>SELECT * FROM PRO_SCHT INTO CURSOR PROSCHT WHERE ALLTRIM(PRO_SCHT.SPFLAG)="*"
>SELECT 0000000000.000 AS CNTRANGE ,* FROM proscht a INTO DBF &pscht where EXISTS(SELECT * FROM PROD_TRAN b WHERE (a.p_number=b.p_number AND ALLTRIM(b.TRANNUMBER)=ALLTRIM(m.trannumber)))
>

I think your problem has to do with the EXISTS subquery. When you use EXISTS and reference fields from the main query in the subquery (that's called a "correlated subquery"), FoxPro has to run the subquery for each record in the main query. If you can rewrite it using IN and a subquery that's not correlated, it should speed up. And the good news is that any EXISTS subquery can be rewritten as an IN subquery.

WHERE a.p_number + ALLTRIM(a.TRANNUMBER) IN ;
(SELECT b.p_number + ALLTRIM(m.trannumber) FROM PROD_TRAN b)

Of course, you have to make sure the expression is all character and will match correctly.

Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform