In case you don't know, NOLOCK
is equivalent to the transaction isolation level named "READ UNCOMMITTED
." I'd recommend reading this blog post from Paul White to understand some of the data integrity implications of using the NOLOCK
hint: The Read Uncommitted Isolation Level
To your question though, you mention this justification for potentially adding the hint:
Thus, all the reports regarding the dbo.rptdepitemdetailsResearch have a potential to block other transactions (insert/update/delete) while it executes.
I would say not to worry about this unless your users / applications are actually experiencing blocking due to this reporting view.
If there is blocking, you could use the READ UNCOMMITTED
isolation level, but note (from Paul's blog post) that it's possible to see totally invalid data in the report.
Another option would be to enable SNAPSHOT ISOLATION
in the database:
ALTER DATABASE YourDatabase
SET ALLOW_SNAPSHOT_ISOLATION ON;
And then have any code that queries your view use the SNAPSHOT
isolation level:
SET TRANSACTION ISOLATION LEVEL SNAPSHOT;
This will prevent your reporting query from blocking insert / update queries, and will also make the reporting query accurate to the point in time the query started.
There is overhead to using this option, including increases to the database size and increased usage of TempDB. So make sure you test accordingly.