Data page structure for SQL Server
In the forum, people often ask how SQL Server is the base table data, since do not want to check MSDN, I'm here to say it
How is each row of data stored in the data page?
Structure: Each SQL Server data page is roughly divided into 3 parts: page header, footer offset, data storage these 3 parts
Suppose you now have a table with the structure:
CREATE TABLE Test (
A INT,
b INT
)
He stores the data on the 1:100 page (1 is the data file ID of the database i.e. fileid,100 is the PageID page number).
This page structure is roughly the following figure
In the first part of the page, records page properties, including page numbers, and also records where the current page's idle portion starts, so that SQL Server can quickly find where to begin inserting new data, and the offset at the end of the page records the starting position of each data row. So when SQL Server is looking for every record, it can quickly find a way to confuse the previous record with the latter. There are now two entries on the Legend page: (1,100) and (2,200) the beginning of the first record is 96, the beginning of the second record is 111, starting from 126, is free space when the data row in the page changes, SQL Server not only to modify the data itself, You also modify the values of these offsets to ensure that SQL Server continues to accurately manage each row in the data page.