SQL Server Performance Optimization (12) composite index storage structure for nonclustered indexes

Source: Internet
Author: User

One, nonclustered index combined index

Users can index on multiple columns, which are called composite indexes (combined indexes). However, composite indexes require less overhead during database operations and can replace multiple single indexes. Using this method can significantly speed up the query speed of a table when the number of rows in the table is much larger than the number of index keys.
At the same time, there are two concepts called Narrow Index and wide index, narrow index refers to index column 1-2 index, if not special description is generally referred to as a single index. A wide index is an index that has more than 2 columns in the index column.
An important principle of designing indexes is the ability to use narrow indexes without wide indexes, because narrow indexes tend to be more efficient than composite indexes. Having more narrow indexes will give the optimizer more room to choose from, which often helps improve performance.

/****** Object:index [Nonixuser] Script date:05/25/2015 09:03:01 ******/
CREATE nonclustered INDEX [nonixuser] on [dbo]. [Users]
(
[NAME] Asc
[ID] ASC
)
GO

or in the GUI.

Two, the root node structure of the combined index

First look at the physical structure of the table

--Turn on trace flag
DBCC TRACEON (3604,2588)
--DBCC Traceoff (3604,2588)
---Gets the data page of the object, structure: Database, object, display
DBCC IND (ixtest,users,-1)

Viewing the contents of the first index leaf node

DBCC page (ixtest,1,201,3)

Note:

1. when a composite index query does not contain columns, the RID query is still gone.

2. If it is an include index, it will also be in the index leaf node more relevant columns, but its column header does not contain (key) this keyword. As follows

Reference:

Description of the limit on the number of column columns included on MSDN: https://technet.microsoft.com/zh-cn/library/ms191241 (v=sql.105). aspx

SQL Server Performance Optimization (12) composite index storage structure for nonclustered 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.