1. Introduction
Indexes make queries fast — until they don’t.
Over time, SQL Server indexes become bloated, fragmented, duplicated, unused, or simply outdated because the nature of your workload has changed. DBAs manually tune indexes, but in modern large-scale systems with hundreds of tables and thousands of daily queries, manual index management is no longer sustainable.
This article introduces the Continuous Index Tuning System (CITS) — an automated, intelligent module that continuously analyzes workload patterns, monitors index health, identifies missing/duplicate/unused indexes, and automatically generates safe index recommendations.
The system uses a mixture of SQL metadata, extended events, query store, heuristics, and optional machine-learning scoring.
2. What Problems CITS Solves
2.1 Fragmentation accumulation
As data is inserted, updated, and deleted, indexes become fragmented, which slows down scans and increases IO.
2.2 Stale/unused indexes
Many systems have dozens of indexes that are queried less than once a month but heavily slow down INSERT/UPDATE/DELETE.
2.3 Duplicate / overlapping indexes
These increase maintenance cost without adding value.
2.4 Missing indexes
Developers create new queries but forget to create supporting indexes.
2.5 No workload awareness
Traditional scripts run blindly without knowing actual query patterns.
3. CITS System Architecture
Below is a simplified architecture diagram.
+----------------------+ +---------------------------+
| SQL Workload | | Query Store + Statistics |
| (Applications) | ----> | Extended Events |
+----------------------+ +---------------------------+
\ /
\ /
\ /
+----------------------------------------------+
| CITS ENGINE |
| - Index Usage Analyzer |
| - Fragmentation Monitor |
| - Duplicate Index Detector |
| - Missing Index Advisor |
| - Recommendation Scoring Module |
| - Scheduler (Continuous or Nightly) |
+----------------------------------------------+
|
|
+-----------------------+
| Action Executor |
| (Manual or Auto Mode) |
+-----------------------+
4. ER Diagram (Internal Metadata Tables)
CITS uses internal metadata tables to store history and recommendations:
+----------------------+ +----------------------+
| CITS_IndexHealth | | CITS_Recommendations |
+----------------------+ +----------------------+
| IndexId (PK) | | RecId (PK) |
| TableName | | IndexId |
| IndexName | | RecType |
| FragPercent | | BenefitScore |
| PageCount | | Script |
| UsageReads | | CreatedOn |
| UsageWrites | +----------------------+
| LastAnalyzed |
+----------------------+
5. CITS Workflow (Sequence Diagram)
App Queries --> SQL Server --> Query Store --> CITS Engine
|
V
Index Usage Analyzer
|
V
Fragmentation + Duplicate Check
|
V
Missing Index Detection
|
V
Generate Recommendations
|
V
Output SQL Scripts
|
V
(Auto-Execute or Manual)
6. Core Components and Logic
6.1 Index Usage Analyzer
Uses

Join the conversation! Your thoughts help the community grow.