Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Index size
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
01111388
Message ID:
01111602
Views:
18
>>When I pack a file - apart from removing references to deleted records - does the index file get optimised in size - or does it get more and more bloated as time goes by?
>>
>>Is there any way of optimising the size of an index file?
>>
>>Thanks
>>
>>Colin
>
>Check this simple program
>
>CREATE TABLE Test (MyName C(50), Nsuma N(10,2))
>INDEX ON SUBSTR(Myname, 1,10) TAG ind1
>INDEX ON SUBSTR(Myname,11,10) TAG ind2
>INDEX ON SUBSTR(Myname,21,10) TAG ind3
>INDEX ON SUBSTR(Myname,31,10) TAG ind4
>INDEX ON SUBSTR(Myname,41,10) TAG ind5
>
>INDEX ON SUBSTR(Myname, 1,10) + STR(Nsuma,10,2) TAG ind11
>INDEX ON SUBSTR(Myname,11,10) + STR(Nsuma,10,2) TAG ind12
>INDEX ON SUBSTR(Myname,21,10) + STR(Nsuma,10,2) TAG ind13
>INDEX ON SUBSTR(Myname,31,10) + STR(Nsuma,10,2) TAG ind14
>INDEX ON SUBSTR(Myname,41,10) + STR(Nsuma,10,2) TAG ind15
>
>FOR iii = 1 TO 100000
>    INSERT INTO Test VALUES([asdfghjkl23423432opwerwerwe],iii+iii/100)
>NEXT
>allrecno = RECCOUNT()
>USE
>=ADIR(myarr,[Test.cdx])
>MESSAGEBOX([The size of Test.cdx with ]+TRANSFORM(allrecno,[999 999])+[ records is ]+TRANSFORM(myarr[2],[999 999 999])+[ bytes]) &&& the result is 6 474 240 bytes
>
>USE Test EXCLUSIVE
>FOR iii = 1 TO 100000 STEP 10
>    GOTO iii
>    DELETE
>NEXT
>PACK
>allrecno = RECCOUNT()
>USE
>=ADIR(myarr,[Test.cdx])
>MESSAGEBOX([The size of Test.cdx after pack with ]+TRANSFORM(allrecno,[999 999])+[ records is ]+TRANSFORM(myarr[2],[999 999 999])+[ bytes]) &&& the result is 5 782 016 bytes
>
>The program give the same results with VFP8 SP1 and VFP9 SP1.
>
>Put
>
Reindex
>The results are the same.
>HTH

Thanks for that

Colin
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Previous
Reply
Map
View

Click here to load this message in the networking platform