Difficulty: Easy
Correct Answer: Correct
Explanation:
Introduction / Context:Indexes accelerate read queries but are not free. This item tests whether you know that indexes require extra storage and must be maintained whenever indexed columns change, affecting write performance.
Given Data / Assumptions:
Concept / Approach:Creating an index materializes additional metadata to speed lookups. Each index consumes disk (and memory when cached). When rows are inserted, updated, or deleted, index entries must be created, modified, or removed, adding CPU and I/O work. Clustered and nonclustered indexes differ in structure, but both have maintenance overhead. Thus, indexing strategy balances read performance against write costs and storage.
Step-by-Step Solution:
Estimate query patterns to justify indexes.Consider cardinality and selectivity for index usefulness.Account for write amplification when indexing frequently updated columns.Monitor fragmentation and rebuild/reorganize as needed.Verification / Alternative check:Measure transaction latency before and after index creation on a hot column; write latency typically increases due to index maintenance.
Why Other Options Are Wrong:
Common Pitfalls:Over-indexing tables and indexing low-selectivity columns (e.g., boolean flags), which adds cost without benefit. Periodically review unused indexes.
Final Answer:Correct
Discussion & Comments