What is the difference between a clustered and non-clustered index in a database?
In a database, a clustered index defines the physical order of data in a table, where the rows are stored in the underlying table in the same order as the index. This means that a table can have only one clustered index, and modifying the clustered index can physically reorder the rows in the table.
On the other hand, a non-clustered index does not define the physical order of data in a table. Instead, it stores the index key values and pointers to the actual data rows in a separate structure, allowing for multiple non-clustered indexes to be created on a single table. This makes non-clustered indexes flexible and efficient for retrieving specific data quickly.
In summary, the main difference between a clustered and non-clustered index is how the data is physically stored in the database and how the index affects the performance of data retrieval operations.
Please login or Register to submit your answer