a report in my application runs a query that needs between 5 – 15 seconds (constrained to count of rows that will be returned).
The query has 8 joins to nearly all main-tables of my application (Customers, sales, units etc).
A little tool shows me, that in this time, all those 8 tables are locked with a shared table lock. That means, no update operation will be done in this time.
A solution from a friend is, to have every join in the query, which is not mandetory to have 100% correct data (dirty read), with a NoLock, so only 1 of this 8 tables will be locked completly.
Is that a good solution? For a report in which 99% of data came from one table, unlock the less prio tables?
Try looking at READ COMMITTED SNAPSHOT rather than NOLOCK. This means the data could be “old” but will never be dirty.