Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Create index on Local Views...
Message
From
08/09/2004 16:24:41
Mike Yearwood
Toronto, Ontario, Canada
 
 
To
08/09/2004 08:58:28
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00938374
Message ID:
00940404
Views:
27
Hi Alan

Actually, It's been proven that it's much faster to append 10,000 records and then index them than it is to append the 10,000 records with the indexes in place.

LOCAL m.lcSetSafety
m.lcSetSafety = SET("SAFETY")
SET SAFETY OFF
LOCAL ;
m.lnA,;
m.lnI

CREATE CURSOR test4 (cField1 c(10))
m.lnA=SECONDS()
FOR m.lnI = 1 TO 10000
INSERT INTO test4 FROM MEMVAR
ENDFOR
INDEX ON cField1 TAG cField1
?SECONDS()-m.lnA

CREATE CURSOR test4 (cField1 c(10))
INDEX ON cField1 TAG cField1
m.lnA=SECONDS()
FOR m.lnI = 1 TO 10000
INSERT INTO test4 FROM MEMVAR
ENDFOR
?SECONDS()-m.lnA
SET SAFETY &lcSetSafety

However, since we're talking views here, the problem is more one of when to build the indexes. For one, if the buffers have been dirtied, you'd have to clean them before you could index.

>>>I always just make sure I open them with NODATAONLOAD = .T., index them empty, and then requery after the indexing is complete.
>>>
>>>Alan
>>
>>Could you explain why this approach is better?
>>Thanks
>>Kamil
>
>Only because it's a lot faster to index 0 items than to index 10,000 items.
>
>Alan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform