Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Huge table and seek/indexseek commands
Message
From
09/08/2002 11:30:58
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
09/08/2002 11:11:08
Walter Meester
HoogkarspelNetherlands
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00687800
Message ID:
00688022
Views:
39
Walter, thanks a lot for this information.

>Hi hilmar,
>Incrementing keys are ofter the cause of unbalanced indexes, Since most indextypes are based on the B-tree mechanism, all new values are added on the outhermost right side of the three. When a node is full, a new child is added on the rightside again (and so on).

Yes, that's exactly what I was afraid might happen. So, neither the SEEK() command, nor a query or view are "safe" (since they all rely on the index).

I guess I'll have to reindex more frequently.

>In the worst case the B-Tree isn't a B-tree but a sequential file of indexvalues. ...

That must be what happened to Nadya.

>When having lot's of keys (records) in the index seeking an indexvalue can get slow. Reindexing the file should get a new balance where all values are equally spread in the B-Tree. Theorecticly SEEKing a value in a table of N records would require at most 1+ INT(LOG(N)/LOG(2)) steps.

Theoretically, that is, if the index is completely balanced.

I guess you could simplify the expression above (in VFP) to ceiling(log(N) / log(2)).

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform