Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does NOLOCK on Views propagate to the underlying tables?

Tags:

If you include a NOLOCK hint on a select from a VIEW, does that NOLOCK hint propagate down into the tables joined within the view? If not, what's the purpose of locking a view?

Sample view code:

CREATE VIEW [my_custom_view] AS   SELECT     a1.[column_a], a1.[column_b], a1.[column_c], a1.[column_d]   FROM     [table_a] a1     JOIN [table_b] b1 ON b1.[column_a] = a1.[column_b] 

And the NOLOCK statement:

SELECT    [column_a], [column_b] FROM   [my_custom_view] NOLOCK 
like image 784
eduncan911 Avatar asked Jun 11 '09 15:06

eduncan911


1 Answers

Yes, it does.

Using WITH NOLOCK Table Hint in Query Using View - Does it Propagate Within the View?

like image 55
jinsungy Avatar answered Sep 25 '22 11:09

jinsungy