Sobes.tech
Junior — Middle

Why does a table allow only one clustered index?

sobes.tech AI

Answer from AI

A table can have only one clustered index because the clustered index determines the physical order of storing rows in the table. The physical order can only be one — rows are stored on disk in a specific order corresponding to the clustered index.

If there were multiple clustered indexes, the table would need to be stored in multiple physical orders simultaneously, which is impossible. Therefore, other indexes are called non-clustered and contain references to the rows rather than changing their physical order.

Example: if a clustered index is built on the "ID" field, then the rows will be physically sorted by "ID". Another clustered index on a different field is impossible.

Why does a table allow only one clustered index? — C# - sobes.tech