← All topic guides

Topic Guide

SQL Server Correctness and Performance

There are two kinds of database story here, and they're more related than they look. The first is performance: an index seek that read far more than its name promised, a query plan that looked exactly like a bot swarm until it wasn't, an admin screen that took 25 seconds because everyone trusted the wrong query. The second is data recovery: a customer's entire site deleted and rebuilt from a shared multi-tenant database, a one-shot repair script built to run against production and be trusted, a datetime value that corrupted a migration because 1900-01-01 looks like a real date.

What connects them is correctness under pressure. A slow query and a wrong row are both cases where the database told you one thing (an operator name, a symptom, a root cause) and the truth was somewhere else. The posts below are grouped that way: performance and correctness incidents first, then the recovery and repair discipline that makes touching production data survivable, dry runs, diffable artifacts, and scripts that assert their own assumptions instead of hoping they hold.

If you're debugging a query plan or writing a repair script tonight, the pattern worth stealing is the same in both halves: verify the actual shape of the data or the actual size of the seek range before you trust the label SQL Server gave it.

21 posts in this guide, by DX

Start here

An Index Seek Can Still Read Far More Than You Expect

An execution-plan operator did not reveal the size of its seek range. In this verified, non-overlapping range dataset, a differently oriented covering index substantially reduced worst-case reads after staged testing.

· 5 min read

Execution plans and index design

Correctness: datetimes, types, and shapes

When the incident wore a performance costume

Data recovery and the repair-script discipline

Build the diagnostic before you touch anything

Hitting one of these walls in your own codebase or your own machine? Talk it through with us, or read the rest of the Build Log.