Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. benefit of cluster index on view in sql 2008 r2

benefit of cluster index on view in sql 2008 r2

Scheduled Pinned Locked Moved Database
databasesaleshelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mhd sbt
    wrote on last edited by
    #1

    hi to all i have a table that product ID is key and clustered . i create this view on my table if i not use of cluster index on view whats happen?

    CREATE VIEW View3 WITH SCHEMABINDING AS
    SELECT ProductID, SUM(UnitPrice*(1.00-UnitPriceDiscount)) AS Price,
    COUNT_BIG(*) AS Count, SUM(OrderQty) AS Units
    FROM Sales.SalesOrderDetail
    GROUP BY ProductID
    GO
    CREATE UNIQUE CLUSTERED INDEX iv3 ON View3 (ProductID)

    note to this point that Product ID also Cluster index in base table thanks for any help

    S 1 Reply Last reply
    0
    • M mhd sbt

      hi to all i have a table that product ID is key and clustered . i create this view on my table if i not use of cluster index on view whats happen?

      CREATE VIEW View3 WITH SCHEMABINDING AS
      SELECT ProductID, SUM(UnitPrice*(1.00-UnitPriceDiscount)) AS Price,
      COUNT_BIG(*) AS Count, SUM(OrderQty) AS Units
      FROM Sales.SalesOrderDetail
      GROUP BY ProductID
      GO
      CREATE UNIQUE CLUSTERED INDEX iv3 ON View3 (ProductID)

      note to this point that Product ID also Cluster index in base table thanks for any help

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      Have a read of this http://blog.sqlauthority.com/2010/10/12/sql-server-indexed-view-always-use-index-on-index/[^] and this is a detailed article on how the clustered index works https://www.simple-talk.com/sql/learn-sql-server/effective-clustered-indexes/[^]

      Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

      M 1 Reply Last reply
      0
      • S Simon_Whale

        Have a read of this http://blog.sqlauthority.com/2010/10/12/sql-server-indexed-view-always-use-index-on-index/[^] and this is a detailed article on how the clustered index works https://www.simple-talk.com/sql/learn-sql-server/effective-clustered-indexes/[^]

        Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch

        M Offline
        M Offline
        mhd sbt
        wrote on last edited by
        #3

        thank you for reply

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups