Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Rushmore optimization
Message
De
24/02/2005 09:17:57
Mike Yearwood
Toronto, Ontario, Canada
 
 
À
23/02/2005 16:40:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Database:
Visual FoxPro
Divers
Thread ID:
00989848
Message ID:
00990059
Vues:
23
Correction INLIST() has been optimizable probably as far back as vfp6.

>>Hi
>>
>>I have a large table with a status field and I want to select the records for a group os status's.
>>the table is indexed on the status
>>
>>this can be done by
>>
lcStatusList = 'AFTHEW'
>>SELECT* ;
>>FROM mytable ;
>>WHERE mytable.status $ ?lcStatusList
>>
>>Unfortunately, this does not optimize.
>>
>>Is there any way to fully optimize this query without expanding the Select to something like
>>
>>
SELECT* ;
>>FROM mytable ;
>>WHERE mytable.status = 'A' OR ;
>>	mytable.status = 'F' OR ;
>>	mytable.status = 'T' OR ;
>>	mytable.status = 'H' OR ;
>>	mytable.status = 'E' OR ;
>>	mytable.status = 'W'
>
>You could use the INLIST() function in your WHERE clause but likely that won't optimize either. CORRECTION: in VFP9 the INLIST() option is reported as fully optimized.
>
>Something you could try:
SELECT ;
>  * ;
>  FROM MyTable ;
>  WHERE MyTable.Status IN ("AFTHEW")
>
>What I usually do in cases like this is create a GetWhereClause() function and do something like
lcWhereClause = GetWhereClause("AFTHEW")
>* above sets lcWhereClause to "myTable.status = 'A' OR ..."
>
>* Then,
>SELECT ;
>  * ;
>  FROM MyTable ;
>  WHERE &lcWhereClause
Using macro substitution like this basically costs nothing, it's called only once during parsing of the SELECT - SQL and not during its actual execution.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform