只读数据库上的NoLock

时间:2022-05-31 06:23:35

I have a database which is used just for reporting. Various users access this Database .

我有一个仅用于报告的数据库。各种用户访问此数据库。

all of these users have only Read only access.

所有这些用户都只具有只读访问权限。

So I have only read only access for this database.

所以我只读了这个数据库的访问权限。

Should i use NOLOCK for these ? Is It help full for read only access user ?

我应该使用NOLOCK吗?只读访问用户是否有帮助?

1 个解决方案

#1


0  

This has been covered many many times, TLDR: I wouldn't use it atall. The only scenarios is if you want for example a really rough row count ballpark figure of a massive table and don't care if it is slightly wrong, but even still - you should prefer creating good indexes, adding RAM or changing the Isolation Level of the query/server.

这已被多次覆盖,TLDR:我不会全部使用它。唯一的情况是,如果你想要一个非常粗略的行计数大型表的球场数字并且不关心它是否有点错误,但即便如此 - 您应该更喜欢创建好的索引,添加RAM或更改隔离级别查询/服务器。

Resources and suggestions for alternatives:

替代方案的资源和建议:

https://www.brentozar.com/archive/2016/12/nolock-ever-right-choice/

https://www.brentozar.com/archive/2016/12/nolock-ever-right-choice/

Is the NOLOCK (Sql Server hint) bad practice?

NOLOCK(Sql Server提示)是不是很糟糕的做法?

https://blogs.sentryone.com/aaronbertrand/bad-habits-nolock-everywhere/

https://blogs.sentryone.com/aaronbertrand/bad-habits-nolock-everywhere/

https://dba.stackexchange.com/questions/10655/is-nolock-always-bad

https://dba.stackexchange.com/questions/10655/is-nolock-always-bad

#1


0  

This has been covered many many times, TLDR: I wouldn't use it atall. The only scenarios is if you want for example a really rough row count ballpark figure of a massive table and don't care if it is slightly wrong, but even still - you should prefer creating good indexes, adding RAM or changing the Isolation Level of the query/server.

这已被多次覆盖,TLDR:我不会全部使用它。唯一的情况是,如果你想要一个非常粗略的行计数大型表的球场数字并且不关心它是否有点错误,但即便如此 - 您应该更喜欢创建好的索引,添加RAM或更改隔离级别查询/服务器。

Resources and suggestions for alternatives:

替代方案的资源和建议:

https://www.brentozar.com/archive/2016/12/nolock-ever-right-choice/

https://www.brentozar.com/archive/2016/12/nolock-ever-right-choice/

Is the NOLOCK (Sql Server hint) bad practice?

NOLOCK(Sql Server提示)是不是很糟糕的做法?

https://blogs.sentryone.com/aaronbertrand/bad-habits-nolock-everywhere/

https://blogs.sentryone.com/aaronbertrand/bad-habits-nolock-everywhere/

https://dba.stackexchange.com/questions/10655/is-nolock-always-bad

https://dba.stackexchange.com/questions/10655/is-nolock-always-bad