About index files

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.