I have a view containing N levels of nested views with UDFs and TVFs that I have to tune and my execution plan has 630+ nodes.

I found the performance issue in the plan but I can't find the source query from within all the nested views. Is there an easy way to find the culprit query or am I doomed to dig through it all and test each query out?

The database is an Azure SQL Instance.



There's not an easy way to do that, because views are inlined like any query abstraction. Probably the least painful way is to use the "View Dependencies" tab in SSMS to find which views depend on which functions.


For example, the dependency report for Ola's scripts show the objects that depend on dbo.CommandExecute.


  • Well, at least that saves me some time in just annoyingly digging into the views. Thanks Erik! This way I can also determine the N levels of hierarchy in my views. Fortunately, it's just only 10 levels. Dec 3 '21 at 0:56
  • @RaduGheorghiu It could always be worse 😉 Dec 3 '21 at 3:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.