SQL - CTE vs VIEW

Both will be interpreted exactly the same by the Plan Optimizer. It's just a different thing.

A view can be used on its own. It can encapsulate complex statements to a more simple query.

Where a CTE is mostly used to write cleaner code with lesser redundancy in procedures/views for example. You can use a CTE for recursive queries too, which is a very great and powerful feature!

I hope this helps to clarify things.


Views can be indexed but CTE can't. So this is one important point.

CTE work excellent on tree hierarchyi.e. recursive

Also, consider views when dealing with complex queries. Views being a physical object on database (but does not store data physically) and can be used on multiple queries, thus provide flexibility and centralized approach. CTE, on the other hand are temporary and will be created when they are used; that's why they are called as inline view.

Update

According to your updated question, views will be the right choice. Dealing with 3.5 million rows in CTE will create extra overhead on TempDb which will eventually slow down SQL Server performance. Remember, CTE is a disposable view hence no statistics are stored and you can't create Indexes too. It is just like a sub query.