SQL Server Table locks in long query - Solution: NoLock?

Posted by Kovu on Stack Overflow See other posts from Stack Overflow or by Kovu
Published on 2009-07-08T14:44:35Z Indexed on 2010/04/02 2:43 UTC
Read the original article Hit count: 373

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about sql

Related posts about query