In The Annals
When people talk about bad ideas in SQL Server, implicit transactions are pretty high on the list.
By “not much” I mean “nothing at all”. Which isn’t to knock the procedure at all; it hasn’t quite lived long enough to become a villain.
But anyway, you should avoid implicit transactions as much as possible. They most often show up in the Microsoft JDBC driver queries that only people who hate you use.
When I first started to realize how bad they are, I wrote a bunch of checks into the Blitz scripts (I’ll cover those next week) that check for them.
I also opened an issue to add the check to sp_WhoIsActive, because it’s rather popular, I hear.
In The Actions
To see when queries are using implicit transactions, you need to do this:
EXEC sp_WhoIsActive @get_transaction_info = 1;
Which, I mean, seems like a rational design choice. Want information about implicit transactions? Get transaction info!
In the results, you’ll see this helpful column that will tell you if something is setting the implicit transactions property to true for a session.
If you see this, burn the application down. It’s time to start fresh.
Thanks for reading!
If this is the kind of SQL Server stuff you love learning about, you’ll love my training. I’m offering a 75% discount to my blog readers if you click from here. I’m also available for consulting if you just don’t have time for that, and need to solve database performance problems quickly.