SQL Server Pages and Extents


This entry is part 2 of 5 in the series SQL Server Data Structures

The page is the fundamental unit of data storage in SQL Server. An extent is a collection of eight physically contiguous pages. Extents help efficiently manage pages. This means that when SQL Server needs to go to disk to get some data, the absolute minimum amount of data that it can fetch is one page.

At Microsoft Docs online, Microsoft says: “The disk space allocated to a data file (.mdf or .ndf) in a database is logically divided into pages numbered contiguously from 0 to n. Disk I/O operations are performed at the page level. That is, SQL Server reads or writes whole data pages.” Pages refer to disk storage, not memory (RAM) storage.

Pages

In SQL Server the page size is 8 KB. This means SQL Server databases have 128 pages per megabyte. Each page begins with a 96-byte header that is used to store system information about the page.

Microsoft says: “Data rows are put on the page serially, starting immediately after the header. A row offset table starts at the end of the page, and each row offset table contains one entry for each row on the page. Each entry records how far the first byte of the row is from the start of the page. The entries in the row offset table are in reverse sequence from the sequence of the rows on the page.”.

Log files do not contain pages; they contain a series of log records.

Extents

An extent is eight physically contiguous pages, or 64 KB. SQL Server databases have 16 extents per megabyte. SQL Server does not allocate whole extents to tables with small amounts of data, since this would not be efficient.

Series Navigation<< SQL Server Internal Data StructuresSQL Server B-Tree >>