Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting slower!
Message
De
31/07/2001 18:30:36
 
 
À
31/07/2001 18:14:59
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00537775
Message ID:
00538080
Vues:
9
>>....code after tables have been opened
>>
>>SELECT Table1
>>SCAN
>>REPLACE Field1 WITH FieldValue IN Table1
>> IF SEEK(Field2, "Table2", 2)
>> IF Table2.Field1 = .T.
>> INSERT INTO Table3 blah blah blah.....
>> ENDIF
>> ENDIF
>>ENDSCAN
>>
>>There you go, basically what it is doing.
>>
>>Kev
>
>
>INSERT is definitely the problem because you insert a record at the current record pointer position with each call. That means you rewrite the entire table from the top down each time and as the number of records in the table increases, the amount of time to rewrite the table increases. Use APPEND instead as this will add each new record to the end of the table and save lots and lots of disk I/O.


Actually, that's an INSERT INTO - which adds it at the end, just like APPEND - and it's faster, since you don't need an APPEND with a REPLACE or GATHER.

INSERT may put it at the current record pointer, but only if there's not an index (and maybe not for other reasons). The command is only there for backward compatibility to pre-VFP versions, anyway.
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform