I'm using NOLOCK; is that bad?
I'm using NOLOCK; is that bad?

Yes. Sure, there are edge cases where accuracy is not a priority, but they aren't that common. When you're looking for ballpark estimates or grabbing a random row, go nuts. But please don't defend, propose, or implement a policy like thou shalt use NOLOCK on every table reference ever. If you don't think those policies exist, ask around; it's more common than you probably think.

Anyway, here are some resources about NOLOCK, with a lot more detail than a vague "thar be dragons" warning…

So what do I do instead?

Typically, the solution to the "readers blocking everyone" problem is to use read committed snapshot isolation (RCSI). This option isn't free, but if you are querying an Availability Group secondary replica, it's the behavior you're getting anyway. Michael Swart, Kendra Little, Erik Darling, and Paul White discuss some of the ramifications in the following posts:

By: Aaron Bertrand

I am a passionate technologist with industry experience dating back to Classic ASP and SQL Server 6.5. I am a long-time Microsoft MVP, write at Simple Talk, SQLPerformance, and MSSQLTips, and have had the honor of speaking at more conferences than I can remember. In non-tech life, I am a husband, a father of two, a huge hockey and football fan, and my pronouns are he/him.