Debugging

16 posts
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
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
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
Misleading SSMS Connection

Misleading SSMS Connection

Read a cautionary tale on how I've deceived the SSMS, then promptly forgot about it and, in turn, ultimately confused myself.

Investigation 3 min read Debugging · Docker
What's in a name? (T-SQL Tuesday #152)

What's in a name? (T-SQL Tuesday #152)

My T-SQL Tuesday rant: an app that connects as '.Net SqlClient Data Provider' turns debugging into a manhunt. Please, name your apps.

T-SQL Tuesday 2 min read Debugging · Extended Events
What is causing my constraint to be untrusted?

What is causing my constraint to be untrusted?

You fix an untrusted constraint, and by morning it's back to untrusted. Here's how to catch the process responsible, using Extended Events.

Investigation 7 min read Extended Events · Debugging
Expecting Subvertations

Expecting Subvertations

How can 15 be less than 13? A perfect storm of bad assumptions about sql_variant comparison rules.

Investigation 5 min read Debugging
How to audit data modifications with surgical precision

How to audit data modifications with surgical precision

A colleague needed to find who was changing a specific cell in a busy table. SQL Audit was too noisy, Query Store too vague. I found a way to combine triggers with Extended Events for surgical precision.

Investigation 8 min read Extended Events · Debugging
IS Lock in RCSI Enabled Database

IS Lock in RCSI Enabled Database

I found an IS lock in a deadlock report on an RCSI database. That shouldn't be possible. Here's what caused it.

Investigation 6 min read Extended Events · Debugging
Don't Be Lazy

Don't Be Lazy

Sometimes the fastest help is the kind you find yourself. A rundown of the lazy question patterns I keep seeing in SQL help channels.

Opinion 4 min read Debugging · Productivity
Investigating Errors With Extended Events

Investigating Errors With Extended Events

Production errors are hard to reproduce. Here's my go-to Extended Events session that captures errors with their full TSQL calling stack.

How to 6 min read Extended Events · XML