Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Encryption & Indexing - What do you do?
Message
 
To
04/05/2007 06:12:04
John Ryan
Captain-Cooker Appreciation Society
Taumata Whakatangi ..., New Zealand
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01222371
Message ID:
01222432
Views:
15
Hi John,

>I thought an index in a cdx was a b-tree with no actual data in it.

In VFP the index contains the value of each index key in a compressed form. For instance, in Customers.CDX at the end you find this block:
00000039B0: 52 4E 53 48 45 41 53 54 │ 43 55 4D 4F 4E 44 52 41  RNSHEASTCUMONDRA
00000039C0: 43 44 4E 53 48 4F 4D 4D │ 49 48 4F 50 53 45 4E 54  CDNSHOMMIHOPSENT
00000039D0: 43 43 41 43 54 55 53 42 │ 45 56 54 54 4D 4E 41 50  CCACTUSBEVTTMNAP
00000039E0: 4F 4C 49 44 4F 4E 50 4C │ 41 55 53 42 45 52 47 53  OLIDONPLAUSBERGS
00000039F0: 52 4F 55 54 54 4F 4E 4E │ 41 54 52 41 4C 46 4B 49  ROUTTONNATRALFKI
which is the ID of every record in alphabetical inverse order: ALFKI is the last entry. NATR is ANATR. The first letter is shared with the previous entry and so forth. The number of shared characters is in the tree list in the same data block along with the record number.

VFP uses the index to quickly search data. If the tree had only pointers to the record, VFP would have to read in the table every time it performs an index search. With data in the index file, most optimization is done exclusively in the index. If you use INDEXSEEK() or have a fully optimized query that counts records, the DBF file isn't touched at all.
--
Christof
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform