(Original) Analysis of SQL Server indexes (I)

Source: Internet
Author: User
Tags sql server query
I. Concepts
An index is a distributed storage structure created to accelerate the retrieval of data rows in a table.
1. indexes are created for tables;
2. An Index consists of an index page other than the data page for storing tables. That is to say, an index requires a separate storage space.

Ii. Index classification
There are two types of indexes: clustered index and non-clustered index.
Shows the structure of the clustered index:

 
"Root Node" and "Intermediate Level" are collectively referred to as "index pages", also known as "non-leaf level ". The root node stores the first element of each page at the intermediate level. Store the first element of each page of the data page at the intermediate level.
Shows the structure of a non-clustered index:

The root node stores the first element of each page at the intermediate level. However, storing the data page in the middle level is not the first element of each page, but maintains a hash table-like structure in the middle level.
Comparison of the two indexes:
1. In clustered indexes, table data is arranged in the order of indexes. In non-clustered indexes, the physical order of the table is different from that of the index, that is to say, the table data is not sorted by the index column.
2. Each table can have only one clustered index, which should be the first index. The non-clustered index of each table can reach 294.
3. The middle-level elements of these two indexes are arranged sequentially.

Iii. How to accelerate the query of Indexes
From the concept, we know that one feature of an index is to accelerate the retrieval of data rows in a table. How is it accelerated?
The index is similar to the book directory or appendix. we can locate the book content directly by looking for the page number in the book directory. The index is a direct path to the data. (Note: the SQL Server Query Optimizer depends on indexes)

Related Article

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.