Junior — Middle
What is the maximum number of cluster indexes allowed for a single table in a database?
sobes.tech AI
Answer from AI
Most modern database management systems (e.g., Microsoft SQL Server) allow only one clustered index per table. The clustered index determines the physical order of data storage in the table, so having more than one clustered index is impossible.
If you need to index a table on multiple columns, non-clustered indexes are created.
Example:
- Clustered index: defines the order of rows in the table (usually on the primary key).
- Non-clustered indexes: separate data structures pointing to table rows.
Thus, the maximum number of clustered indexes on a table is 1.