What can happen as a result of using (nolock) on every SELECT in SQL Server?

前端 未结 2 1769
[愿得一人]
[愿得一人] 2020-12-29 09:16

I get that the (nolock) optimizer hint allows for \"dirty reads\", but under what very specific scenarios is this a bad idea? I\'ve never seen such widespread u

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-29 09:48

    I recently spent a great deal of time figuring out some time and blocking issues for a data warehouse build process. As it turns out, due to the read-only nature of the data for loading the warehouse, I added nolock hints to the source data queries for the etl to reduce the requirement for lock escalation on the sql server and kept the etl load from failing. For this one I had very little control over the sql server and the application. Again, this was a targeted solution and I don't recommend widespread use of any query hints as a general rule. Like all performance testing and review, there are key areas to look at to determine where the problem lies and what might be the best way to attack it.

提交回复
热议问题