Database Reference
In-Depth Information
When SQL Server needs to allocate a new uniform extent, it can use any extent where a bit in the GAM page has
the value of one. When SQL Server needs to find a page in a mixed extent, it searches both allocation maps looking for
the extent with a bit value of one in a SGAM page and the corresponding zero bit in a GAM page. If there are no such
extents available, SQL Server allocates the new free extent based on the GAM page, and it sets the corresponding bit to
one in the SGAM page.
Every database file has its own chain of GAM and SGAM pages. The first GAM page is always the third page in the
data file (page number 2). The first SGAM page is always the fourth page in the data file (page number 3). The next
GAM and SGAM pages appear every 511,230 pages in the data files which allows SQL Server to navigate through them
quickly when needed.
SQL Server tracks the pages and extents used by the different types of pages (in-row, row-overflow, and LOB
pages), that belong to the object with another set of the allocation map pages, called Index Allocation Map (IAM) .
Every table/index has its own set of IAM pages, which are combined into separate linked lists called IAM chains . Each
IAM chain covers its own allocation unit —IN_ROW_DATA, ROW_OVERFLOW_DATA, and LOB_DATA.
Each IAM page in the chain covers a particular GAM interval and represents the bitmap where each bit indicates
if a corresponding extent stores the data that belongs to a particular allocation unit for a particular object. In addition,
the first IAM page for the object stores the actual page addresses for the first eight object pages, which are stored in
mixed extents.
Figure 1-14 shows a simplified version of the allocation map pages bitmaps.
Figure 1-14. Allocation map pages
Partitioned tables and indexes have separate IaM chains for every partition. We will discuss partition tables in
greater detail in Chapter 15, “Data Partitioning.”
Note
There is another type of allocation map page called Page Free Space (PFS) . Despite the name, PFS pages track
a few different things. We can call PFS as a byte-mask, where every byte stores information about a specific page, as
shown in Figure 1-15 .
 
 
Search WWH ::




Custom Search