Junior — Middle
Explain the principle of operation of clustered indexes in database management systems.
sobes.tech AI
Answer from AI
A clustered index in a DBMS is an index that determines the physical order of data storage in a table. Unlike a non-clustered index, where the index and data are stored separately, a clustered index sorts and stores the table rows in the order of the index key.
This speeds up queries that use range conditions on the clustered index key, as the data is physically located nearby. Usually, a table can have only one clustered index, since data can only be sorted in one way.
For example, in SQL Server, the primary key by default creates a clustered index, which improves the performance of queries on this key.