I used to check B-Tree. I flipped through the index file and looked at it. Forget it.
What is an index file?
In addition to the file itself (that is, the data zone), another table that establishes a correspondence relationship between logical records and physical records is an index table, these files, including the file data area and index table, are called index files.
An index is automatically generated by the system. An index table is created when the data area is set up for record input, which is arranged in the input order. After the input, the index table is sorted.
Why is indexing fast?
First, the index is ordered, so you can follow the half lookup method.
Secondly, the index item length is usually far smaller than the record length, and can be directly put into the memory, reading speed is also fast. In this way, only the read index is used to read files from external villages twice, which is fast.
Of course, not all situations can be fully put into the memory. If a physical block cannot be placed, you can create an index on the index table, which is called a query table, a second query table, and a third query table.
Multi-level indexes are classified into static indexes and dynamic indexes.
The indexes at all levels of the static index are ordered, but the index needs to be restructured when it is modified. Therefore, when there are many changes, dynamic indexes are not suitable for static indexes.
If the number of file records is small and the index table is not large, and the memory can be accommodated at one time, you can use the binary sorting tree or the Balance Tree for indexing;
If the number of records is large and the index table is stored externally, you need to use B-Tree for indexing;
Another type is the key tree, which is suitable for index tables with special types of keywords.
In short, the search speed of the index table in external storage depends on the access speed of external storage, that is, the depth of the index table.
About ISAM, VSAM, and hash files... To be continued... MYISAM was not exclusive to mysql, haha... It is found that this part is a file.