In SQL Server, stored procedures execution plans are cached but view execution plan are never cached. Is that true? If yes, why does SQL Server not cache view execution plans?
If a optimizer is taking a long time to create execution plan, is it helpful to wrap the query in a view?
There is no such thing as an execution plan for a view (at best, a parse tree is cached). View is always optimized as a part of the outer query (somewhat simplified, the text of the view is merged with text of the outer query and then optimized).
Will an execution plan of a query using a view be cached or not depends on the very same factors as with any other query.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With