Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Speeding up APPEND
Message
From
14/02/2001 13:10:51
Jonathan Cochran
Alion Science and Technology
Maryland, United States
 
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00475722
Message ID:
00475883
Views:
38
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 ...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform