What are the differences between a clustered and a non-clustered index?

后端 未结 12 1376
攒了一身酷
攒了一身酷 2020-11-29 14:24

What are the differences between a clustered and a non-clustered index?

12条回答
  •  生来不讨喜
    2020-11-29 14:51

    Clustered Index

    • Only one clustered index can be there in a table
    • Sort the records and store them physically according to the order
    • Data retrieval is faster than non-clustered indexes
    • Do not need extra space to store logical structure

    Non Clustered Index

    • There can be any number of non-clustered indexes in a table
    • Do not affect the physical order. Create a logical order for data rows and use pointers to physical data files
    • Data insertion/update is faster than clustered index
    • Use extra space to store logical structure

    Apart from these differences you have to know that when table is non-clustered (when the table doesn't have a clustered index) data files are unordered and it uses Heap data structure as the data structure.

提交回复
热议问题