Short answer: "It depends"
Longer answer: "It depends on the request form"
Like any SQL Server performance question (which is better: x vs y), there is no right answer. In the case of views against sprocs, there is no way to reliably predict which one (if any) is faster than query profiling.
I saw how they are faster, and it comes down to how the view is used and whether it is part of a larger query. I also saw the slow queries look down because they can hide the greater complexity that a query using a view is not really needed.
You need to evaluate what you are trying to achieve: if all you do is access the rows of the table and you donβt want to use the output as part of another query, I would choose a stored procedure, especially if the query to the table takes some WHERE clause.
Where will the request be called from? Another piece of SQL? Some application framework? User level data access? It is worth considering how the call code is going to combine the query, as this may affect how SQL Server finishes caching and reusing the execution plan. If it simply connects a bunch of dynamic SQL, performance may be slightly affected, as SQL Server may need to rebuild the query plan each time; therefore, in this case sproc has the advantage of a cached plan. If the access level is intelligent and parameterizes dynamic SQL, there may not be many in it.
Conclusion: understand what you want to achieve. Then profile, tuning, tuning, and repeating until satisfied.
source share