Query / SP tuningNational law firm, anonymized × red9CS-0301
An authentication lookup run 23,000 times a day, from 128 ms to 1 ms
The problem. A large national law firm had an authentication lookup sitting on its application sign-in path. It ran about 23,000 times a day at roughly 128 ms each, reading around 11,000 pages per call. Multiplied across the day, that one lookup was eating close to an hour of SQL time and slowing every login.
What we did. We rewrote the lookup and added a covering index on its filter, so it seeks a handful of rows instead of reading thousands. Before and after were captured in the same session.
Red9 · Performance Impact
SQL capacity reclaimed
~49 min / day
Across ~23,000 daily runs of one lookup, on the same hardware.
Per-call duration
128x
128 ms down to 1 ms per call.
Disk reads, per call
~3,700x less
About 11,000 down to 3 per call, IO off the box.
Duration
128 ms → 1 ms
128x shorter
Disk reads
~11,000 → 3
~3,700x less
Executions
~23,000 / day
unchanged
Where the figures come from. Each multiple is the old value divided by the new one, so 128 ms over 1 ms is 128x. The ~49 minutes reclaimed daily is roughly 23,000 runs a day at the ~127 ms trimmed off each. It all traces to the firm's own readings on both sides.
The result. The lookup now returns in about a millisecond and reads 3 pages instead of 11,000. Across roughly 23,000 logins a day, the firm gets back close to 49 minutes of SQL work, and sign-ins stopped dragging.
The technical detail
What the review turned up. The authentication lookup filtered a large table with no covering index, so each of its ~23,000 daily calls read around 11,000 pages.
What we changed (identifiers generalized for privacy):
-- Authentication lookup: ~11,000 reads, ~128 ms, ~23,000x per day.
CREATE NONCLUSTERED INDEX IX_auth_lookup_covering
ON dbo.[user_auth] (/* filter cols */) INCLUDE (/* output cols */);
-- lookup rewritten to seek the covering index; DROP INDEX rollback provided
The rewrite plus the covering index cut the lookup from about 11,000 reads to 3, and from 128 ms to roughly 1 ms per call.