locked
Clustered Index keys are Stored in Data Page Header RRS feed

  • Question

  • Hi ,

    I am trying to know, Index Keys storage.

    After creating the Clustered Index on a table, so data pages are stored in B+ Tree way.. is my understanding correct ?

    If it is correct , Clustered Index key values are stored in Header of Data page ?

    Please help me to Understand correctly, i am getting confusion by seeing all crash Course Website :)

    Regards,

    Raviteja

    (Habituated by writing unnecessary mails)



    Friday, March 8, 2019 7:14 AM

Answers

  • No, the leaf of the tree *is* the data. the data for all columns are in the index (leaf). The leaf = the data. But the data isn't in the page *header*. It is in the data-area of the page.

    Tibor Karaszi, SQL Server MVP (Web Blog)

    • Marked as answer by RavitejaMaybe Friday, March 8, 2019 12:56 PM
    Friday, March 8, 2019 12:44 PM

All replies

  • Are you asking if the *value* of the clustered key is stored in the header? No, that wouldn't make sense, since you have many rows on a page, and rows with different values for the clustering key (just imagine a primary key, which you cluster over).

    Or, are you asking if *what column* is the index key is stored in the page header (the ID for the column)? No, the id for the index key(s) isn't stored in the page header either.


    Tibor Karaszi, SQL Server MVP (Web Blog)

    • Marked as answer by RavitejaMaybe Friday, March 8, 2019 12:09 PM
    • Unmarked as answer by RavitejaMaybe Friday, March 8, 2019 12:09 PM
    Friday, March 8, 2019 10:05 AM
  • Thanks for rely, understood your point. Please confirm below understanding.

    • Cluster Index create on a table means.. one Index Page created (all index keys maintain in B+ tree manner) in data file
    • Leaf level in B+ Tree having Data page address. 

    Thank you again 


    Friday, March 8, 2019 12:07 PM
  • No, the leaf of the tree *is* the data. the data for all columns are in the index (leaf). The leaf = the data. But the data isn't in the page *header*. It is in the data-area of the page.

    Tibor Karaszi, SQL Server MVP (Web Blog)

    • Marked as answer by RavitejaMaybe Friday, March 8, 2019 12:56 PM
    Friday, March 8, 2019 12:44 PM