Sleeping Query with Open Transactions

sp_BlitzFirst® Result:
Sleeping Query with Open Transactions

According to sp_BlitzFirst®‘s diagnostics, someone started a transaction, got some locks, and hasn’t released them. This can indicate a dangerous application query pattern like this:

BEGIN TRAN
SELECT somestuff FROM sometable
(then do some processing in the app)
COMMIT

With this pattern, we might be holding locks much longer than necessary.

To improve performance, ask these questions:

Which queries are sleeping with open transactions? Where are they coming from in the app?

Did someone start a transaction, lock their machine, and then go home for the weekend?

For personalized help with getting the right answers for your server, we’ve got SQL Critical Care®.