02 July, 2019

Extents Architecture

An extent is a group of eight physically consecutive pages in a database data file. One page is 8 KB, therefore one extent is 64 KB. This means SQL Server databases have 16 extents per megabyte.

There are two types of extents in SQL Sever:

Uniform Extents:
All eight physically contiguous pages belong and can be used only by a single object.(table, index, ...) This is a uniform extent.








Mixed Extents:
All eight physically contiguous pages belong and can be used multiple object.(table, index, ...) This is a mixed extent.








How does SQL Server allocate Extents and Pages:
To make space allocation more optimize, SQL server will not allocate pages from uniform extent to a table or index if its size is less than 8 pages.
SQL sever first allocates pages for new table or indexes from mixed extents.Once the tables grow beyond 8 pages, SQL server has to allocate page from uniform extent.
When a table or index need more space to accommodate the new or modified data, SQL server has to allocate page for the table or index.
If the size of the table or index is less than 8 pages, SQL server has to locate a page from mixed extent to allocate.
If the size is more than 8 pages, SQL server has to locate the page from uniform extent.
GAM and SGAM pages helps the database engine in extent management.

No comments:

Post a Comment