Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scan or Select, then scan
Message
 
À
28/01/2002 10:57:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00611587
Message ID:
00611782
Vues:
17
I'm gonna go out on a limb and wager two cents that your first example

SELECT Table
SCAN FOR Ref = lcRef
lnRecNo = RECNO()
SCATTER MEMVAR
m.Ref = lcNewRef
INSERT INTO Table FROM MEMVAR
GO lnRecNo
ENDSCAN

might probably run slightly faster than the second example, especially if an index on ref exists and the order is set to the index tag containing that expression.

In your Example 2, Fox must still navigate through the records by performing a SQL - Select; however, it might also create either a filter on the original table or temp files; while this is not guaranteed to occur, the chance that it might occur esists and would take some miniscule amount of time LONGER that the first example would not require.

Better yet, comment out the storage and retrieval of the record number in your first example and don't scatter. Instead, try

SELECT ThisTable
SCAN FOR Ref = lcRef
INSERT INTO NewTable (Fld1, Fl12, Fld3) ;
VALUES (ThisTable.Fld1, lcNewRef, ThisTable.Fld3)
ENDSCAN

Not guaranteed to be any faster but who knows? It might eliminate the overhead of the added I/O cycles necessary to read the data into memory variables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform