PAGE_TYPE
|
頁(yè)類型
|
頁(yè)類型碼
|
描述
|
1
|
Data Page
|
DATA_PAGE
|
數(shù)據(jù)頁(yè)(Data Page)用來(lái)存放數(shù)據(jù)
l 堆中的數(shù)據(jù)頁(yè)
l 聚集索引中“葉子“頁(yè)
|
2
|
Index Page
|
INDEX_PAGE
|
索引頁(yè)(Index Page),聚集索引的非葉子節(jié)點(diǎn)和非聚集索引的所有索引記錄
|
3
|
Text Mixed Page
|
TEXT_MIX_PAGE
|
一個(gè)文本頁(yè)面,其中包含小塊的LOB值以及text tree的內(nèi)部,這些可以在索引或堆的同一分區(qū)中的LOB值之間共享。
A text page that holds small chunks of LOB values plus internal parts of text tree. These can be shared between LOB values in the same partition of an index or heap.
|
4
|
Text Tree Page
|
TEXT_TREE_PAGE
|
A text page that holds large chunks of LOB values from a single column value
|
7
|
Sort Page
|
|
在排序操作期間存儲(chǔ)中間結(jié)果的頁(yè)面
|
8
|
Global Allocation Map Page
|
GAM_PAGE
|
GAM在數(shù)據(jù)文件中第三個(gè)頁(yè)上,文件和頁(yè)的編號(hào)為(1:2),它用bit位來(lái)標(biāo)識(shí)相應(yīng)的區(qū)(extents)是否已經(jīng)被分配。它差不多能標(biāo)識(shí)約64000個(gè)區(qū)(8k pages * 8 bits per byte),也就是4G的空間,如果數(shù)據(jù)空間超過(guò)4G,那么數(shù)據(jù)庫(kù)會(huì)用另外一個(gè)GAM頁(yè)來(lái)標(biāo)識(shí)下一個(gè)4G空間
Bit=1: 標(biāo)識(shí)當(dāng)前的區(qū)是空閑的,可以用來(lái)分配
Bit=0: 標(biāo)識(shí)當(dāng)前的區(qū)已經(jīng)被數(shù)據(jù)使用了
|
9
|
Shared Global Allocation Map Page
|
SGAM_PAGE
|
SGAM在數(shù)據(jù)文件的第四個(gè)頁(yè)上,文件和頁(yè)編號(hào)為(1:3),它的結(jié)構(gòu)和GAM是一樣的,區(qū)別在于Bit位的含義不同:
Bit=1:區(qū)是混合區(qū),且區(qū)內(nèi)至少有一個(gè)頁(yè)是可以被用來(lái)分配的
Bit=0:區(qū)是統(tǒng)一區(qū), 或者是混合區(qū)但是區(qū)內(nèi)所有的頁(yè)都是在被使用的
|
10
|
Index Allocation Map Page
|
IAM_PAGE
|
表或索引所使用的區(qū)的信息。
|
11
|
Page Free Space Page
|
PFS_PAGE
|
存儲(chǔ)本數(shù)據(jù)文件里所有頁(yè)分配和頁(yè)的可用空間的信息
|
13
|
Boot Page
|
BOOT_PAGE
|
包含有關(guān)數(shù)據(jù)庫(kù)的相關(guān)信息。 數(shù)據(jù)庫(kù)中有且只有一個(gè)。它位于文件1中的第9頁(yè)。
|
15
|
File header page
|
FILEHEADER_PAGE
|
文件標(biāo)題頁(yè)。 包含有關(guān)文件的信息。 每個(gè)文件一個(gè),文件的第0頁(yè)。
|
16
|
Differential Changed Map
|
DIFF_MAP_PAGE
|
自最后一條BACKUP DATABASE語(yǔ)句之后更改的區(qū)的信息
|
17
|
Bulk Changed Map
|
|
自最后一條BACKUP LOG語(yǔ)句之后的大容量操作鎖修改的區(qū)的信息
|
18
|
|
|
a page that's be deallocated by during a repair operation
|
19
|
|
|
the temporary page that (or DBCC INDEXDEFRAG) uses when working on an index
|
20
|
|
|
a page pre-allocated as part of a bulk load operation, which will eventually be formatted as a ‘real' page
|
另外,關(guān)于sys.dm_db_database_page_allocations
的輸出字段信息如下所示(搜索相關(guān)資料結(jié)合自己的理解,如果錯(cuò)誤,敬請(qǐng)指出):
字段
|
中文字段描述
|
英文描述
|
database_id
|
數(shù)據(jù)庫(kù)ID
|
ID of the database
|
object_id
|
表或視圖對(duì)象的ID
|
Object ID For the table or view
|
index_id
|
索引ID
|
ID for the index
|
partition_id
|
索引的分區(qū)號(hào)
|
Partition number for the index
|
rowset_id
|
索引的Partition ID
|
Partition ID for the index
|
allocation_unit_id
|
分配單元的 ID
|
ID of the allocation unit
|
allocation_unit_type
|
分配單元的類型
|
Type of allocation unit
|
allocation_unit_type_desc
|
分配單元的類型描述
|
Description for the allocation unit
|
data_clone_id
|
|
?
|
clone_state
|
|
?
|
clone_state_desc
|
|
?
|
extent_file_id
|
區(qū)的文件ID
|
File ID of the extend
|
extent_page_id
|
區(qū)的文件ID
|
Page ID for the extend
|
allocated_page_iam_file_id
|
與頁(yè)面關(guān)聯(lián)的索引分配映射頁(yè)面的文件ID
|
File ID for the index allocation map page associate to the page
|
allocated_page_iam_page_id
|
與頁(yè)面關(guān)聯(lián)的索引分配映射頁(yè)面的頁(yè)面ID
|
Page ID for the index allocation map page associated to the page
|
allocated_page_file_id
|
分配頁(yè)面的File ID
|
File ID of the allocated page
|
allocated_page_page_id
|
分配頁(yè)面的Page ID
|
Page ID for the allocated page
|
is_allocated
|
該頁(yè)是否被分配出去了
|
Indicates whether a page is allocated
|
is_iam_page
|
是否為IAM頁(yè)
|
Indicates whether a page is the index allocation page
|
is_mixed_page_allocation
|
是否分配的混合頁(yè)面
|
Indicates whether a page is allocated
|
page_free_space_percent
|
頁(yè)面的空閑比例
|
Percentage of space free on the page
|
page_type
|
頁(yè)面的類型(數(shù)字描述)
|
Description of the page type
|
page_type_desc
|
頁(yè)面的類型描述
|
|
page_level
|
頁(yè)的層數(shù)
|
|
next_page_file_id
|
下一個(gè)頁(yè)的 Fiel ID
|
File ID for the next page
|
next_page_page_id
|
下一個(gè)頁(yè)的Page ID
|
Page ID for the next page
|
previous_page_file_id
|
前一個(gè)頁(yè)的File ID
|
File ID for the previous page
|
previous_page_page_id
|
前一個(gè)頁(yè)的Page ID
|
Page ID for the previous Page
|
is_page_compressed
|
頁(yè)是否壓縮
|
Indicates whether the page is compressed
|
has_ghost_records
|
是否存虛影記錄記錄
|
Indicates whether the page have ghost records
|
簡(jiǎn)單了解了上面知識(shí)點(diǎn)后,我們?cè)谑褂眠@個(gè)DMF找出表或索引相關(guān)的頁(yè)面,基本上可以讀懂這些輸出信息了。
USE AdventureWorks2014 GO SELECT DB_NAME(pa.database_id) AS [database_name] , OBJECT_NAME(pa.object_id) AS [table_name] , id.name AS [index_name] , pa.partition_id AS [partition_id], pa.is_allocated AS [is_allocated], pa.allocated_page_file_id AS [file_id] , pa.allocated_page_page_id AS [page_id] , pa.page_type_desc , pa.page_level , pa.previous_page_page_id AS [previous_page_id] , pa.next_page_page_id AS [next_page_id] , pa.is_mixed_page_allocation AS [is_mixed_page_allocation], pa.is_iam_page AS [is_iam_page], pa.allocation_unit_id AS [allocation_unit_id], pa.has_ghost_records AS [has_ghost_records] FROM sys.dm_db_database_page_allocations(DB_ID('AdventureWorks2014'), OBJECT_ID('TestDeadLock'), NULL, NULL, 'DETAILED') pa LEFT OUTER JOIN sys.indexes id ON id.object_id = pa.object_id AND id.index_id = pa.index_id ORDER BY page_level DESC , is_allocated DESC , previous_page_page_id;
參考資料:
https://www.sqlskills.com/blogs/paul/inside-the-storage-engine-anatomy-of-a-page/
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,謝謝大家對(duì)腳本之家的支持。
標(biāo)簽:天水 七臺(tái)河 來(lái)賓 銅仁 宿州 防疫戰(zhàn)設(shè) 益陽(yáng) 威海
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《SQL Server怎么找出一個(gè)表包含的頁(yè)信息(Page)》,本文關(guān)鍵詞 SQL,Server,怎么,找出,一個(gè),;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。