Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Index size
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
01111388
Message ID:
01111594
Vues:
13
>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
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform