Architecture
Size Estimation
Two paths:
Missing Index: Data Sampling (v2.0)
sp_GetHybridIndexSizeEstimatetries similarity-based estimation first- Falls back to
sp_CalculateIndexSizeEstimatewhich samplesAVG(DATALENGTH())on 10,000 rows - Much more accurate than v1.0 (which used
max_length / 4guesses)
Key Lookup: Proportional Scaling
- Gets
avg_record_size_in_bytesfromsys.dm_db_index_physical_stats - Samples
AVG(DATALENGTH())for each new column - Formula:
new_size = current_size * (avg_row + avg_new_bytes) / avg_row
Key rule: Estimate ≥ current size. Adding columns can never shrink an index. Both paths enforce a floor of current size + 5%.
Display Conventions
| What | Format | Example |
|---|---|---|
| Existing index size | MB, 1 decimal | 178.5 MB |
| Estimated new size | MB, 1 decimal | 184.3 MB |
The EstimatedSizeGB column stores values in GB (historical), but display always converts: FORMAT(EstimatedSizeGB * 1024, 'N1') + ' MB'.
Schema
All objects in the indexing schema in DBA_Utilities. 6 results tables (one per tool), ~22 procs, 8 functions (internal to optimize-index).