CTE vs View Performance in SQL Server

Which one is faster:

  • request from cte
  • request from view

(in complex queries). I have a complex request, and I have another complex request from the first. Does it create a view faster for the first complex query and a query from the view or uses cte?

+3
performance sql-server
source share
1 answer

A view is a permanent object, and the results can be indexed, and the CTE is temporary and only created when used so less flexibly. It will be more efficient to break your complex query into indexed views than to CTE. It will be most effective to ensure that all tables are properly indexed, which is likely to do more for performance than to worry about opinions against CTE.

+9
source share

All Articles