Covering index on a JSON workloadLarge law firm, anonymized × red9CS-0313
A matter feed reading 1.6 billion pages a day came down to 179,883
The problem. A large law firm ran a matter-feed query that pulled values out of a JSON column on a wide entity table. It executed about 759 times a day, took 11,187.59 ms per call, and accounted for roughly 2.36 hours of SQL time and 1.6 billion logical reads every day. Each call was effectively reading the entire document set to find recent rows.
What we did. We proposed and tested a covering index keyed on the entity type and the modified date, carrying the identifier and the JSON payload as included columns, so the engine can locate the right rows before it parses a single document.
Red9 · Performance Impact
Daily reads
8,921x
1,604,710,437 down to 179,883.
Per-call duration
76x
11,187.59 ms down to 147.26 ms.
Daily time returned
~2 hrs
Recovered across about 759 calls a day on the same hardware.
Duration
11,187.59 ms → 147.26 ms
76x shorter
CPU
5,801.36 ms → 96.9 ms
60x less
Daily reads
1.60B → 179,883
overall 9,054x
Daily reads
for this query
How the math works. The 76x is 11,187.59 ms over 147.26 ms; the 8,921x is 1,604,710,437 reads over 179,883. The two hours a day is roughly 759 calls multiplied by the 11 seconds each one gave back. The firm's report recorded its own combined improvement as 905,370 percent, or about 9,054x, a composite across duration, CPU, and reads.
The result. The matter feed returns in about a seventh of a second, its daily read volume fell from 1.6 billion pages to under 180,000, and roughly two hours of daily SQL time went back to the rest of the firm's workload.
The technical detail
What the review found. The query filtered on values extracted from a JSON column, which the optimizer cannot seek on, so it scanned the whole entity table on every call and parsed documents it would then discard.
What we changed (identifiers generalized for privacy):
-- Matter feed: ~759 calls/day, 11,187.59 ms each, ~1.6B reads/day on a JSON column.
CREATE NONCLUSTERED INDEX IX_red9_entity_type_modified
ON dbo.[entity_instances] (entityTypeName, dateModified) INCLUDE (systemId, jsonPayload);
-- rollback: DROP INDEX IX_red9_entity_type_modified provided
Seeking on the type and date first means the parse only ever happens on rows that survive the filter, which is where the 8,921-fold read reduction comes from.