Data pages contain all the data in data rows except text, ntext, and image data, which is stored in separate pages. Data rows are placed serially on the page starting immediately after the header. A row offset table starts at the end of the page. The row offset table contains one entry for each row on the page and 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.
Rows cannot span pages in SQL Server. In SQL Server 2000, the maximum amount of data contained in a single row is 8060 bytes, not including text, ntext, and image data.
Extents are the basic unit in which space is allocated to tables and indexes. An extent is 8 contiguous pages, or 64 KB. This means SQL Server 2000 databases have 16 extents per megabyte.
To make its space allocation efficient, SQL Server 2000 does not allocate entire extents to tables with small amounts of data. SQL Server 2000 has two types of extents:
Uniform extents are owned by a single object; all eight pages in the extent can only be used by the owning object.
Mixed extents are shared by up to eight objects.
A new table or index is usually allocated pages from mixed extents. When the table or index grows to the point that it has eight pages, it is switched to uniform extents. If you create an index on an existing table that has enough rows to generate eight pages in the index, all allocations to the index are in uniform extents.
在SQL中,頁是存放數據的最小單位。一頁的大小是8K = 8 * 1024 bit. 所以1M的數據要有(1024K = 1024/8 =128頁)128頁才可以存儲.
Extents(分區)是分配給表和索引空間的最小單位。一區是由8個連續的頁組成。區有以下兩種類型:混合類型/簡單類型
所謂簡單類型就是指該區中的所有頁都屬於同一個對象。混合類型指的是該區中的8個頁可能屬於不同的對象。也就是說一個混合類型的區最多可以屬於8個對象。
在SQL中,為了保證空間分配的高效率。分區分配按以下原則:
1:當新建表/索引時,分配混合區中的頁。
2:當隨表/索引的增長,其中的數據超過8頁時,該區就會自動轉換為簡單類型區。
3:如果在一個已存在的表中建立索引,且表中有足夠的記錄使得索引的大小超過8頁時,那麼一開始分配給索引的也就是一個簡單區。
浙公网安备 33010602011771号