Clustered vs. Non-Clustered Index in Database System - Interview Question Answer
When it comes to indexes in a database system, understanding the difference between a clustered index and a non-clustered index is crucial for a Database Administrator. Here's a brief explanation:
Clustered Index:
A clustered index in a database system defines the physical order of the data in the table. When a clustered index is created on a table, the rows are stored in the table based on the order of the clustered index key. Each table can have only one clustered index. This index is particularly useful for range queries or queries that require scanning a range of values.
Non-Clustered Index:
Unlike a clustered index, a non-clustered index does not dictate the physical order of the data in the table. Instead, it creates a separate structure that stores the index key values and pointers to the actual data rows. This allows for quicker retrieval of data based on the indexed columns. Multiple non-clustered indexes can be created on a single table.
Overall, the choice between a clustered and non-clustered index depends on the specific requirements of your database system and the types of queries you need to optimize for performance.
Please login or Register to submit your answer