Performance of VIEW vs. SQL statement Performance of VIEW vs. SQL statement database database

Performance of VIEW vs. SQL statement


Depending on the database vendor, in general, the execution of a query against a view combines the SQL defined in the View with the Where clause predicates and Order By clause sort expressions appended to the sql that you pass against the View, to come up with a combined complete SQL query to execute. This is then executed as though it had itself been passed to query processsor, so there should be no difference.

Views are an organizational tool, not a performance enhancement tool.

From SQL Server View resolution

When an SQL statement references a nonindexed view, the parser and query optimizer analyze the source of both the SQL statement and the view and then resolve them into a single execution plan. There is not one plan for the SQL statement and a separate plan for the view.


Regular (non indexes / materialized) Views are just aliases; they don't offer any performance advantages. Selecting from a View generates exactly the same query plan as selecting directly from the table.


Views aside, aren't the PrimaryKey AND clauses redundant? If the PrimaryKey value is IN a list, wouldn't it not be IN the other list? I think condensing those two clauses into one would boost performance.