简体   繁体   中英

Covering Index versus Clustered Index (Database 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 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 aa "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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM