How does SQL Server handle updates on views. I am worried about performance and wanted to know overview of how and when views change.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A [non-materialized] view is just a stored query that gets run when you use the view name in a query.
Performance for a [non-materialized] view comes from the query getting cached, because the view’s underlying query doesn’t change. Once the view query is altered, the first time will take a little longer than subsequent ones because there’s nothing in the query cache.
You can use sp_refreshview, but have I have experienced locking (even within a READUNCOMMITTED transaction).
Materialized (“indexed” in TSQL/SQL Server) views are a different matter.