April 13, 2012 at 11:59 pm
There is a table in database having millions of records.
Will view helpful to retrieve data faster?
there are millions of data in table so tables must be having some size ,if i make a view of particular table then that view also consist a data..Do view consume database size or not???
Thanks & Regards,
Pallavi
April 14, 2012 at 5:06 am
Views are virtual parts of one or more Physical tables. Following is a good article about Views:
Although Views are present in a Database they do not consume any space.
You can test this by creating a view on a table and running the following command on both the table and the View:
EXEC sp_spaceused '<tablename>'
EXEC sp_spaceused '<viewname>'
Hope this was helpful.
April 14, 2012 at 5:18 am
Vews by default do not take up space (over the space used to store the definition) but can take up space if they are clustered indexed views.
create table tEmp(EmpID int, Name varchar(30))
go
create view vEmp with schemabinding as
select EmpID, Name
from dbo.tEmp
go
create unique clustered index vIndex on vEmp(EmpID)
go
exec sp_spaceused 'tEmp'
exec sp_spaceused 'vEmp'
Fitz
April 14, 2012 at 6:00 am
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply