Backup & Recovery from First Principles, Part 3: The Log Chain and How People Break It
showed that log backups form a linked list: each backup’s first_lsn equals the previous backup’s last_lsn. Point-in-time restore works by walking that list. Break one link and every log backup after the break is useless…
Backup & Recovery from First Principles, Part 2: Anatomy of a Backup
A backup file is not a copy of your MDF. It is a container with a precise contract: enough pages and enough log to reconstruct a transactionally consistent database as of the moment the backup…
Backup & Recovery from First Principles, Part 1: Recovery Models Actually Explained
Every SQL Server database has a recovery model, and most databases got theirs by inheritance rather than by decision: whatever model had at CREATE DATABASE time is what you are running today. That default determines…
Scalar UDFs vs Inline TVFs: Measuring the Damage
Scalar user-defined functions are the most natural thing in the world to write. You have a bit of logic, you wrap it in a function, you call it in your SELECT list, and your query…
What Reaches Outside Your Database? sys.dm_db_uncontained_entities
Every database likes to pretend it is self-contained. Then you restore it onto another instance and discover the stored procedure that queries a sister database, the synonym pointing at a linked server, the login-mapped user…
The Guard Clauses Your Index Rebuild Script Needs
Writing a loop that rebuilds fragmented indexes takes about ten minutes. Writing one you can safely leave running unattended at 2 AM takes considerably longer, and the difference is entirely in the guard clauses: the…