# Clustered Indexes vs Heaps
> [!Note]
> Choosing between a [[Clustered Index]] and a [[Heap]] hinges on workload characteristics: while clustered indexes boost performance across inserts, updates, deletes, simple selects and especially range queries, heaps can excel for tiny tables, insert-heavy concurrency, and minimal storage overhead.
### Clustered Index
A [[Clustered Index]] physically orders table rows according to a B-Tree structure on the specified key, which delivers consistent performance improvements across most operations. In benchmark comparisons, tables with a clustered index showed roughly **3% faster INSERTs**, **8.2% better UPDATE** performance on non-indexed columns, **18.3% more efficient DELETEs**, **13.8% gains on simple SELECTs**, and a striking **29.4% improvement on range queries** compared to heaps. These advantages stem from ordered data layouts that enable contiguous I/O and avoid random page access.
> [!tip]
> For workloads that frequently retrieve ordered data or perform range scans (e.g., `WHERE Date BETWEEN ...`), a clustered index can reduce I/O by nearly a third.
### Heap
In contrast, a [[Heap]] stores rows without any particular order, which can lead to full table scans for lookups but offers benefits under specific conditions. Heaps are **recommended for very small tables** where the eight-byte Row Identifier (RID) is more compact than a larger clustered key, and they often **outperform** when the system must sustain extremely high-concurrency inserts without page splits.
> [!info]
> **Heap**
> Use for staging or transient tables where fast, unordered inserts dominate and range queries are rare.
Despite the broad gains of clustered indexes, heaps remain a valid choice when storage footprint and raw insert concurrency outweigh the need for sorted access. Understanding these trade-offs ensures that table design aligns with real-world query and maintenance patterns.
---
## References
- Korotkevitch, D. (2022). _SQL Server advanced troubleshooting and performance tuning: Best practices and techniques_. O’Reilly Media.
- Nevarez, B. (2022). _SQL Server query tuning and optimization: Optimize Microsoft SQL Server 2022 queries and applications_. Packt Publishing.