SQL Server with Mr. Denny

Apr 10 2008   3:00PM GMT

Back To Basics: Views, what exactly are they?



Posted by: mrdenny
SQL, Oracle Views, Back To Basics

Views are strange objects.  They look like tables, can be queried like a table, but they don’t store any actual data.  Think of them as a virtual table which has pointers back to the source tables.  Views can combine data from one or more tables via joins just like a select statement.

Using views does not help or hurt your query performance.  However if you create an index on your view, it will help your performance, however it will increase your storage as SQL will now need to keep the data for the columns of the index from the view on the disk within the index.

Personally I’m not a fan of views, as it distorts the schema of the database.  However like all objects within the database there is a time and a place for thier use.

Denny

Comment on this Post


You must be logged-in to post a comment. Log-in/Register

Back to Basics: The BACKUP DATABASE command - SQL Server with Mr. Denny  |   Jul 22 2008   9:14PM GMT

[...] command will backup all tables, views, procedures, functions, etc as well as all the data within the database.  Backing up the database [...]