all groups > sql server programming > may 2006 >
You're in the

sql server programming

group:

View or Base Table? Which one is faster?



View or Base Table? Which one is faster? Malkesh
5/11/2006 10:55:01 PM
sql server programming: Hi Friends,
In a single query, referening to view is faster or referening to base tabel is
faster.
Consider
I've base table X in which i've column - ColA
and i've one view vwX which built upon table X and many more
table and that view has also column - ColA which is coming from table X.

Now in my query where i'm selecting ColA. I don't require any data from vwX.

Considering this scenario which one is faster? Referening ColA from view or
from base table?
--
Thanks & Regards
RE: View or Base Table? Which one is faster? Omnibuzz
5/11/2006 11:00:01 PM
base_table is faster
unless you views definition is

select col1..... coln
from base_table






[quoted text, click to view]
Re: View or Base Table? Which one is faster? David Portas
5/11/2006 11:10:13 PM
[quoted text, click to view]

It depends on the query, the view, the indexes, etc. The only way to be
sure is to test it out.

--
David Portas, SQL Server MVP

Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.

SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--
Re: View or Base Table? Which one is faster? Jim Underwood
5/12/2006 12:00:00 AM
IF your view pulls data from 5 tables, and you only need data from one
table, then you should access that table directly (or access a view that
references only that table, which is the same thing).

Assuming you have proper indexes, this should be faster every time.

This assumes you will not be using data from those other tables at all.

[quoted text, click to view]

AddThis Social Bookmark Button