What is the difference between clustered and non-clustered index in SQL?

Norbert 1 Reputation point
2021-09-07T11:15:54.063+00:00

What is the difference between clustered and non-clustered index. in SQL ?

SQL Server | Other
{count} votes

2 answers

Sort by: Most helpful
  1. Olaf Helper 47,441 Reputation points
    2021-09-07T11:36:45.073+00:00
    0 comments No comments

  2. AmeliaGu-MSFT 14,006 Reputation points Microsoft External Staff
    2021-09-08T02:44:54.373+00:00

    Hi Norbert-8918,

    Clustered index

    • There can be only one clustered index per table.
    • Clustered indexes sort and store the data rows in the table or view based on their key values.
    • Clustered indexes sort the records and store them physically according to the order.
    • Data retrieval is faster than non-clustered indexes.
    • Clustered indexes do not consume extra space.

    Non-clustered index

    • There can be multiple non-clustered indexes per table.
    • Non-clustered indexes have a structure separate from the data rows. A nonclustered index contains the nonclustered index key values and each key value entry has a pointer to the data row that contains the key value.
    • Non-Clustered Indexes create logical order, and do not match physical stored order of the rows on disk.
    • Data insert and update operation is faster than clustered index.
    • Non-clustered indexes are stored in a separate place from the actual table claiming more storage space.

    In addition, please refer to What is the difference between Clustered and Non-Clustered Indexes in SQL Server and this similar thread which might be helpful.

    Best Regards,
    Amelia


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.