Notes from a TSQL trench

Database stuff,
with a side of memes.

Long-form notes on TSQL performance, Extended Events, Query Store and the tooling around them. Written from the trenches, not the slide deck.

61 posts 4 series 108+ memes
Finding nested references

Finding nested references

Your stored procedure calls another procedure, which calls a view. How deep does it go? Here's a recursive CTE that traces the full dependency chain, including cross-database references.

Investigation 8 min read Debugging
Database CI/CD Basics (T-SQL Tuesday #177)

Database CI/CD Basics (T-SQL Tuesday #177)

A crash course on database CI/CD: source control as the source of truth, state-based vs migration-based versioning, and the many moving parts of automated database deployments.

T-SQL Tuesday 4 min read CI/CD
Service Broker Blocking

Service Broker Blocking

I was paged for a blocking chain where the lead blocker had a transaction name I'd never seen: CSbRollbackHandlerTask::DisableQ. Here is how I reproduced it and why the blocked process report refuses to help.

Deep Dive 4 min read Blocking · Debugging
My Toolbox - SSMS

My Toolbox - SSMS

My SSMS setup guide: layout tweaks, essential Options settings, hotkeys I can't live without, and miscellaneous tips for a better SQL Server Management Studio experience.

Tools 9 min read Productivity
Async stats update causing blocking

Async stats update causing blocking

An index rebuild quietly blocked an async stats update, and the whole server started timing out. Here is the lock-partitioning repro and the SQL Server 2022 fix.

Deep Dive 9 min read Blocking · Debugging
Are ABORT_AFTER_WAIT's victims logged?

Are ABORT_AFTER_WAIT's victims logged?

Does ALTER INDEX REBUILD with WAIT_AT_LOW_PRIORITY log its victims in the error log the same way KILL does? Let's find out.

Deep Dive 3 min read Debugging · Blocking
Extended Events and I (T-SQL Tuesday #166)

Extended Events and I (T-SQL Tuesday #166)

Grant Fritchey asked us to talk about our favourite SQL Server tool for T-SQL Tuesday #166. Mine is Extended Events - and I have the GitHub repo and a public speaking session to prove it.

T-SQL Tuesday 3 min read Extended Events