How to use clustered Index

Source: Internet
Author: User

How to Use clustering index is a type of re-organization of the actual data on the disk to sort by the value of one or more specified columns. Because the index page pointer of the clustered index points to the data page, using the clustered index to search for data is almost always faster than using a non-clustered index. Each table can only create a clustered index, and creating a clustered index requires at least 120% additional space for the table to store copies of the table and the intermediate index page. The idea of building a clustered index is as follows: 1. Most tables should have clustered indexes or use partitions to reduce competition on the last page of the table. In a high transaction environment, blocking the last page seriously affects the system throughput. 2. In the clustered index, data is physically arranged on the data page in order, and duplicate values are also arranged together, therefore, when the queries that contain range checks (between, <, <=, & gt;,> =) or use group by or order, once a row with the first key value in the range is found, the row with the subsequent index value is physically contiguous without further searching, avoiding large-scale scanning, this greatly improves the query speed. 3. When you create a clustered index on a table with frequent insert operations, do not create a column with a monotonous appreciation (such as IDENTITY). Otherwise, blocking conflicts may often occur. 4. Do not include frequently modified columns in the clustered index, because after the code value is modified, the data row must be moved to a new location. 5. Select the cluster index based on the where clause and connection operation type. The optional columns of the clustered index are: 1. Primary Key columns, which are used in the where clause and inserted randomly. 2. Columns accessed by range, such as pri_order> 100 and pri_order <200. 3. Columns used in group by or order. 4. columns that are not frequently modified. 5. Columns Used in connection operations.

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.