Index tuningDental products maker, anonymized × red9CS-0436
An overnight job that stalled production cut from 18 minutes to under a second
The problem. A dental products manufacturer leaned on a nightly stored procedure to close out the day's transactions before the next morning could open. Over time it had crept past 18 minutes per run, more than 1,080,000 milliseconds, and it finally stopped finishing inside its window at all, which stalled the production system and held up the whole business until it cleared.
What we did. We pulled the procedure's plan and statistics, found the filter it ran with no index behind it, and built a covering index so the engine seeks the rows it needs instead of scanning the full table on every pass.
Red9 · Performance Impact
Production stall cleared
18 min → <1s
The stalled overnight job now finishes before anyone is waiting on it.
Run time
~2,160x
Over 1,080,000 ms down to about 500 ms.
Access pattern
scan → seek
A covering index replaced the full-table scan the job used to run every night.
Run time
18 min → <1s
~2,160x shorter
Outcome
Stall → cleared
stable
How the math works. The ~2,160x is the old run time over the new one, about 1,080,000 milliseconds divided by roughly 500. The job used to miss its overnight window and stall production, and it now clears in under a second. Both numbers trace directly to the client's own captures on either side of the fix.
The result. The overnight job now completes in under a second instead of 18-plus minutes, and it finishes its window with room to spare, so the production stall it used to trigger is gone.
The technical detail
What the review found. The nightly procedure filtered a large transaction table that had no index supporting its filter, so every run scanned the table end to end, more than a million reads, and the run time crept past 18 minutes until it blew through its overnight window.
What we changed (identifiers generalized for privacy):
-- Nightly close procedure scanned the full table: 18+ min (1,080,000+ ms) per run.
CREATE NONCLUSTERED INDEX IX_daily_close_covering
ON dbo.[daily_transactions] (/* filter cols */) INCLUDE (/* output cols */);
-- rollback: DROP INDEX script provided
The covering index turned the scan into a seek: the overnight job dropped from more than 18 minutes to under a second, and the production stall cleared.