Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server: Data Page size confusion: 8060 + 96 byte is still less than 8k byte

Tags:

sql-server

SQL Server stores data in pages of 8k (8192) bytes. In a data page, 96 bytes are reserved for page header. Considering the maximum allowed capacity of 8060 bytes for a data page, there are still 36 bytes remained. But I couldn't find any reference talking where this 36-byte block goes to.

Any help?

like image 228
Hans Avatar asked Apr 05 '15 10:04

Hans


People also ask

How many bytes is a SQL page?

Each page begins with a 96-byte header that is used to store system information about the page. This information includes the page number, page type, the amount of free space on the page, and the allocation unit ID of the object that owns the page.

Why page size is 8kb in SQL Server?

The page size is 8k, because that is the maximum size of a record in SQL Server (8096 I believe). However, when data is read, it is read in 64k chunks called extents (8 - 8k pages at a time).

What is the size of a page in SQL Server?

A “Page” is the fundamental unit of data blocks in the SQL Server. These "Pages" are 8-KB in size it means each “Page” contains 8192 bytes.

What is the size of page header in SQL DB?

On a page, SQL Server uses 96 bytes for the page header. We can store 8096 bytes ( 8192-96 bytes) for data in SQL Server. Apart from this, page also contains row overhead and row offset and leaves 8000 bytes to use for data storage.


1 Answers

There is no fixed size specified for Slot Array/Row Offset Array.

Page header occupies the first 96 bytes of each data page (leaving 8,096 bytes for data, row overhead, and row offsets). Out of this, the maximum size of a single data row can be 8,060 bytes.

The number of rows stored on a given page varies depending on the table structure and on the data being stored. A table with all fixed-length columns always can store the same number of rows per page; variable-length rows can store as many rows as will fit based on the actual length of the data entered.

For example, a page can contain more than 19 rows where each row size is 403 bytes. In this case, slot array size would be 38 bytes.

like image 163
Manish Avatar answered Oct 04 '22 19:10

Manish