Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which command would execute faster? Seek & Do while or S
Message
De
29/03/2006 16:46:41
 
 
À
29/03/2006 13:06:25
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01108228
Message ID:
01108989
Vues:
15
>>SUM WHILE is much better than a SUM FOR whether you have a compound expression or not. IOW if you have
>>
SET ORDER TO Cust_ID
>>SEEK m.lcCustID
>>SUM WHILE
>>
>>that will easily beat
>>
>>
SET ORDER TO 0
>>SUM FOR Cust_ID = m.lcCustID
>>
>>Especially as the number of records increases.
>>
>I created a table with 8 million records and 4 fields (I1, I2, D1, C1). I1 was populated with INT(recno()/10000). C1 was populated with PADL(1+mod(recno()),4,"0")
>
>cc = "0008"
>
>SET ORDER TO 0
>n1 = SECONDS()
>SUM I1 TO abc FOR c1 = m.cc
>? SECONDS() - n1
>
>SET ORDER TO 1
>n1 = SECONDS()
>SEEK m.cc
>SUM I1 TO abc WHILE c1 = m.cc
>? SECONDS() - n1
>
>
>The results were equivalent, with the first one seeming to be marginally faster. Strangely enough, I appeared to get best results using SUM FOR when ORDER was set to 1.
>
>This was in VFP 6.
>I'ld be interested in a similar comparison in VFP 9.

try
SET ORDER TO 1
n1 = SECONDS()
SET KEY TO m.cc
SUM I1 TO abc
SET KEY TO
? SECONDS() - n1
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform