Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select SQL vs Copy to Array While... -- Which one wins?
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Select SQL vs Copy to Array While... -- Which one wins?
Divers
Thread ID:
00008720
Message ID:
00008720
Vues:
91
Given a table with a simple 10 character key (lets call it member_id) stored as a typical key in a CDX, guess which is faster:

Assume we have an memvar called cDesiredID

Select Recno() as RecNum, Field1, Field2, etc from MyTable into Cursor MyCursor Where Member_ID = cDesiredID

compared to:

Seek cDesiredID
RecNoSave=Recno()
Copy to Array MyArray Fields AnyField, Field1,Field2, etc While Member_ID=cDesiredID
GoTo RecNoSave
For I=1 to _Tally
MyArray(i,1)=RecnoI()
Skip
EndFor
Use Mycursor
Zap
Append From Array MyArray

Result: The second method, surprising to me, is much, much faster when MyCursor contains only a few (less than a dozen) records. I haven't tested it with more (not necessary in my app).
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform