SQL Server Partition Table index

Source: Internet
Author: User

Indexes are very effective for improving query performance, so it is generally important to consider indexing a partitioned table, indexing a partitioned table and indexing the normal table all the time, but its behavior differs from the normal index.

By default, the indexes created in the partitioned table use the same partition schema and partitioning columns as the partitioned table, so that the indexes are aligned in the table. Aligning a table to its index makes administration easier, especially for sliding window scenarios. To initiate partition switching, all indexes on the table must be aligned.

Although partitioned indexes can be implemented separately from the base table of a partitioned index, it is common practice to design a partitioned table and then create an index for that table. When you do this, SQL Server automatically partitions the index using the same partitioning scheme and partitioning column as the table. Therefore, the partitioning method of the index is essentially the same as the partitioning of the table. This causes the index to be "aligned" with the table. If you specify a different partitioning scheme or a separate filegroup to store the index when you create it, SQL Server does not align the index with the table .

 

partitioning a clustered indexWhen you partition a clustered index, the clustered key must contain a partitioning column.

When partitioning a non-unique clustered index, if the partitioning column is not explicitly specified in the clustered key, SQL Server adds the partitioning column to the clustered index key list by default. If the clustered index is unique, you must explicitly specify that the clustered index key contains the partitioning column.

Partitioning a nonclustered index

When partitioning a unique nonclustered index, the index key must contain the partitioning column.

when partitioning a non-unique nonclustered index, by default SQL Server adds the partitioning column as a non-key (inclusive) column of the index to ensure that the index is aligned with the base table. If the partitioning column already exists in the index, SQL Server will not add the partitioning column to the index

SQL Server Partition Table index

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.