An allocation map is a file that identifies free space and tells the database engine where space is available for storing information. However, there are different types of allocation maps that serve different purposes within an SQL database. The four primary types are Index Allocation Map (IAM), Global Allocation Map (GAM), Shared Global Allocation Map (SGAM), and Page Free Space (PFS).
The most basic unit of free space is a “page,” which constitutes 8kb of disk space. “Extents” are sets of eight pages, which is the basic unit of managed space. The IAM, GAM, and SGAM manage extents, while the PFS manages page space. The IAM, GAM, and SGAM all manage up to 4gb of space (64,000 extents), while the PFS manages up to 4mb of disk space (64,000 pages).
The GAM uses 1 or 0 to determine whether an extent is allocated or not. If the extent = 1, the extent is unallocated and all eight pages are available. If the extent = 0, then it is allocated by at least one page.
The SGAM tracks mixed extents. If the SGAM shows the extent = 1, there is at least one page being used within that extent or at least one page being used by a different object than the other pages within the extent. If the extent is set to 0, it is an unallocated or a dedicated extent.
The IAM is a page that tracks whether an extent is mixed or dedicated in relation to objects and GAMs. An IAM covers a 4gb range like a GAM but is also capable of creating “IAM chains” if a file is accessing more than one extent or more than one 4gb range. An IAM chain is a number of IAM pages that provides an object the location of mixed extents that it may be using. If the IAM shows an extent = 1, then the extent is dedicated to a single IAM page, which means that either the extent is dedicated to one file or it is within the same 4gb range as the GAM and SGAM. If the IAM shows an extent = 0, then the extent is mixed and the file may be allocated across different extents or across different GAMs.
The PFS is tracked on an IAM and is used for determining where large object data will be stored by tracking how much of each page in an extent is allocated. This information is represented in percentages. Where the IAM, GAM, and SGAM use bit designators, the PFS uses byte designators to determine how much space is available for a file to use. The percentages are either 0 = empty, 1 = 0-50%, 2 = 51-80%, 3 = 81-95%, and 4 = 96-100% full.