Thursday, January 8, 2009

WITH (NOLOCK)

Using the NOLOCK hint can speed up queries by allowing the query to not wait while other queries are writing to the table. The downside is that your query can read data that may get rolled back.

FROM table1 a WITH (NOLOCK)
JOIN table 2 b WITH (NOLOCK) ON a.field = b.field
JOIN table3 c WITH (NOLOCK) ON b.field= c.field
JOIN table4e WITH (NOLOCK)


More info: http://msdn.microsoft.com/en-us/library/ms187373.aspx

No comments: