Summary
This chapter covered a lot of ground, so let’s review the overall indexing strategy guidance:
- Clustered index data access is generally more efficient than heaps and every table in the database should have a clustered index, except for short-lived tables such as staging tables.
- Create clustered indexes first based on the data structure. These should generally be primary keys unless there’s a specific reason to cluster a different column or columns (for example, surrogate versus natural keys).
- Create non-clustered indexes on all foreign key columns.
- Once you begin writing queries, create additional non-clustered indexes to support the application queries, or add additional columns to existing foreign key indexes.
- Create covering indexes where practical, balancing overhead with performance.
- Do not over-index heavily updated tables; balance the cost of index maintenance with the benefit to queries. Just because the SQL Database Engine allows...