SQL - View


A view is a stored query

A view is stored as an algebraic closure so it can be optimized when used with queries.

View are slow

That is just not true. A view is nothing more than a stored query. If the stored query text is slow, sure the view (or query against the view) will be slow. A view cannot be any slower than the query itself. When you use the specific query as defined by the view in straight SQL, you'll see the same performance.

Inconvenient / Advantage


No referential integrity

If you get an employee table for instance in a view format, you cannot make a foreign key constraint because the view doesn't have any primary key.

No grain management

You cannot enforce an unique key and then you can get duplicate problem. If not now, in the future.


Easy to implement



Powered by ComboStrap