开发者

Covering Index versus Clustered Index (Database Index)

开发者 https://www.devze.com 2022-12-30 18:31 出处:网络
I\'m working on a database system and it\'s indexes, but I\'m having a really hard time seing the clear difference between a covering index and a clustered index.

I'm working on a database system and it's indexes, but I'm having a really hard time seing the clear difference between a covering index and a clustered index.

I've googled my way around but hasn't got a clear cut answer on:

  1. What is the differences between the two types of indexes
  2. When do I use Covering index and when do I use Clustered index.

I hope someone can explain it to me开发者_如何学C in a almost children-like answer :-)

Sincerely Mestika

By the way, I'm using IBM DB2 version 9.7


I cannot speak to DB2, but the following applies to SQL Server.

When all of the required columns are part of the index the index is called a a "covering index". SQL Server 2005 introduced this type of index by allowing you to have "included columns" in the index. This allows you to include additional columns in the index over the 16 column limit or columns that would be too large to include.

While you can only have one clustered index per table, you can have up to 249 non-clustered indexes per table.

By having a covering index available to satisfy a query, SQL Server won't need to go back to the clustered index to retrieve the rest of the data required by the query.

Randy

0

精彩评论

暂无评论...
验证码 换一张
取 消