Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speeding up APPEND
Message
De
14/02/2001 13:10:51
Jonathan Cochran
Alion Science and Technology
Maryland, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00475722
Message ID:
00475883
Vues:
40
In our import routine, we delete the indexes if we are importing above a certain number of records. Afterwards, we run code similar to what I posted to recreate the indexes. For large numbers of records (50,000 or higher), this can make a significant savings in time. I don't have any exact numbers, but it was enough to need to put that code in.

>Have you tested this to see if it's faster than having the indexes there before the append? (I'm not asking you to do it if you haven't... Just wondering if you had...)
>
>Thanks,
>
>Michelle
>
>
>>You could loop through the indexes in the source table and build an INDEX ON command string for each index. We have similar code that looks something like this:
>>
>>
>>FOR ln_Loop = 1 TO TAGCOUNT()
>>
>>   lc_IndexExpression = "INDEX ON " + SYS( 14, ln_Loop ) + " TAG " + ;
>>      TAG(ln_Loop)
>>
>>   IF !EMPTY( SYS( 2021, ln_Loop ) )
>>      lc_IndexExpression = lc_IndexExpression + " FOR " + SYS( 2021, ln_Loop )
>>   ENDIF
>>
>>   IF DESCENDING( ln_Loop )
>>      lc_IndexExpression = lc_IndexExpression + " DESCENDING"
>>   ENDIF
>>
>>   IF UNIQUE( ln_Loop )
>>      lc_IndexExpression = lc_IndexExpression + " UNIQUE"
>>   ENDIF
>>
>>   IF CANDIDATE( ln_Loop )
>>      lc_IndexExpression = lc_IndexExpression + " CANDIDATE"
>>   ENDIF
>>
>>ENDFOR
>>
>>
>>Note that this doesn't work for Primary Key indexes that are created with ALTER TABLE <> ADD PRIMARY KEY ...
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform