Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Replace In - is it slow?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00496131
Message ID:
00496140
Vues:
10
>>Hi everybody,
>>
>>I wrote a simple function to update our database with data in external file. The function looks like:
>>
>>  scan && External file
>>  if seek(PropID, "AssrMstr","PropID")
>>    replace APN with WorkFile.APN,... in AssrMstr
>>  else
>>    insert into AssrMstr ...
>>  endif
>>  endscan
>>
>>It works very slowly. The external file has ~60000 records. What could be wrong here and should I change algorithm to switch between aliases instead of using IN clause.
>>
>>Thanks in advance.
>
>How many INSERTs are typically done? How many index keys on the table? Anytime you add a record to a table with a compound, compact CDX, it has to update the index as well. If multiple keys are present this will also be true in instances where replaces are done if one of the indexed fields is modified.

Well, this table has lots of indexes. I didn't think about providing a message about is it Insert case or Replace case, so all I can tell you for now it's already working ~ 20 minutes and haven't finished a single town yet (single external file - I wrote the program with for/next loop for all files in a directrory). Perhaps, I have to stop it now. I can create a cursor for inserts, make all inserts into this cursor, then use APPEND FROM command for my main database. It will probably speed up the process.

Thanks for your advice.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform