The difference between views and tables in performance

What is better for tables with a lot of data?

I have a stored procedure that creates a report based on some filters. In my SP, I read the table and placed all the internal connections and formulas, and then in the condition where I put the filters.

Speaking of performance, which is better?

Create a view with all joins or read the table (how do I do this)?

+11
performance sql-server-2005 views
Jan 02 2018-10-10T00:
source share
2 answers

Performance is much more dependent on the availability of appropriate indexes than if you use a view or direct access to a table that (except materialized views) behaves exactly the same.

+14
Jan 02 '10 at
source share

It depends.

As long as the View does not contain aggregates (or constructions requiring upfront materialization), this will be exactly the same performance (and in many cases can go through criteria with a short tweak by the optimizer)

Have you tried benchmarking in your specific cases?

@ Otávio Décio beat me, mentioning that having the “right” indexes would have a greater impact on performance.

+4
Jan 02 2018-10-01T00:
source share



All Articles