MSSQL View

  • 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

  • Views are virtual parts of one or more Physical tables. Following is a good article about Views:

    Views in SQL Server[/url]

    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.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • 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

  • +1 on dat Fitz.

    Forgot to add the part about Clustered Index Views.

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply