Intro

The data in each database in SQL Server is stored with this structure:

To maximize performance via parallel reads and writes, either distribute file groups, files, or objects (tables or indexes) on different drives, or use an appropriate RAID. Members of the db_owner group can manipulate the physical file structure. Databases can be detached from one server and attached to another by the physical files.

File Group

A file group is actually a logical division of the files that compose the database.

File

Each database has at least two files: A primary data file (*.mdf) and a log file (*.ldf). If a database has additional files, then those are classified as secondary data files (*.ndf). Each file has a logical name (system name used in T-SQL statement) and a physical name (file name used by the OS).

Extent

An extent the basic allocated to tables (aka heaps in this context) and indexes. An extent is composed of 8 contiguous pages. If all the pages of an extent describe the same object, then the extent is uniform. If the pages describe one or more objects, then the extent is mixed. This combo of uniform and mixed extents, plus the various tracking pages, allows SQL Server to make efficient use of hard disk space.

Page

A page is the smallest unit in SQL Server. A page is a unit of 8 KB. A page can only describe one object. Pages are numbered sequentially.

There are eight kinds of pages in SQL Server:

Pages appear in this order in each file. The PFS pages appear more frequently since they only cover 8,000 pages where as pages such as GAM cover 64,000 extents or 512,000 pages. Note that IAM pages appear randomly as needed.

  1. File Header Page
  2. PFS
  3. GAM
  4. SGAM
  5. BCM
  6. DCM
  7. Data, Text, and Index
  8. PFS
  9. Data, Text, and Index
  10. ...
  11. PFS
  12. GAM
  13. SGAM
  14. BCM
  15. DCM
  16. Data, Text, and Index
  17. ...

Page Modified: (Hand noted: 2007-10-13 16:10:20Z) (Auto noted: 2007-11-17 06:43:47Z)