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, take a poll; good luck falling asleep now.

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. Kendra Little, Erik Darling, and Paul White discuss some of the ramifications in the following posts:

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 SQLPerformance and MSSQLTips, and have had the honor of speaking at more conferences than I can remember. In non-tech life, I am a father of two, a huge hockey and football fan, and my pronouns are he/him.