定位表和索引使用的Page
数据存储的基本单元是Page,每个Page是8KB,数据文件(mdf和ndf)占用的硬盘空间,逻辑上按照PageNumber进行划分,也就是说,可以把数据文件看作是PageNumber 从0到n的连续Page。硬盘IO的基本单元是Page,这意味着,SQL Server对整个Page执行读写操作。一个Page只属于一个对象(表或index),不会出现一个Page属于两个对象的情况。
每8个物理地址连续的Page构成一个区(Extent),区是空间分配和管理的基本单元,数据库把文件按照区(Extent)进行分配,也就是说,数据库文件的大小的区的倍数。
一,非正式的DBCC IND命令
DBCC IND是一个非正式的命令,用于定位到表或索引使用的Page,该命令的语法结构是:
DBCC IND ( ['database name'|database id], table_name,index_id)
参数index_id的有效值是:
- 1:表示表的聚集索引
- 非聚集索引的index_id
- 0:代表堆(没有创建聚集索引的表)
- -1:表示跟表相关的所有类型的Page(in row data, row over flow data, IAM, all indexes)
- -2:只显示IAM类型的Page
该命令返回的结果如下所示:

结果集中各个字段的含义:
- PageFID — the file ID of the page
- PagePID — the page number in the file
- IAMFID — the file ID of the IAM page that maps this page (this will be NULL for IAM pages themselves as they’re not self-referential)
- IAMPID — the page number in the file of the IAM page that maps this page
- ObjectID — the ID of the object this page is part of
- IndexID — the ID of the index this page is part of
- PartitionNumber — the partition number (as defined by the partitioning scheme for the index) of the partition this page is part of
- PartitionID — the internal ID of the partition this page is part of
- iam_chain_type — see IAM chains and allocation units in SQL Server 2005
- PageType — the page type. Some common ones are:
- 1 – data page
- 2 – index page
- 3 and 4 – text pages
- 8 – GAM page
- 9 – SGAM page
- 10 – IAM page
- 11 – PFS page
- IndexLevel — what level the page is at in the index (if at all). Remember that index levels go from 0 at the leaf to N at the root page
- NextPageFID and NextPagePID — the page ID of the next page in the doubly-linked list of pages at this level of the index
- PrevPageFID and PrevPagePID — the page ID of the previous page in the doubly-linked list of pages at this level of the index
二,系统管理函数 sys.dm_db_database_page_allocations
sys.dm_db_database_page_allocations (@DatabaseId , @TableId , @IndexId , @PartionID , @Mode)
对于@IndexId 和 @PartitionID,如果传递NULL值,表示返回所有索引或分区的信息。
- LIMITED: 表示只返回Page的元数据
- DETAILED :表示返回Page的详细数据
- partition_id:对应于分区的Partition Number
- rowset_id:对应于分区的PartitionID
- allocation_unit_id:分区单元(allocation unit)的ID
- allocation_unit_type、allocation_unit_type_desc:分区单元的类型
- extent_file_id:extent所在的file_id
- extent_page_id:extent包含的page_id
- allocated_page_iam_file_id:跟Page相关联的IAM Page所在的file_id
- allocated_page_iam_page_id:跟Page相关联的IAM Page所在的page_id
- allocated_page_file_id:Page的file_id
- allocated_page_page_id:Page的page_id
- is_allocated:指示该Page是否已分配
- is_iam_page:指示该Page是否是IAM Page
- is_mixed_page_allocation:指示该Page是否位于混合区
- page_free_space_percent:该Page中空闲空间的占比
- page_type、page_type_desc:该Page的类型
- page_level:该Page在索引结构中的Level,叶子节点的Level是0。
- next_page_file_id:下一个Page的file_id
- next_page_page_id:下一个Page的page_id
- previous_page_file_id:前一个Page的file_id
- previous_page_page_id:前一个Page的page_id
- is_page_compressed:指示该Page是否被压缩
- has_ghost_records:指示该Page是否由幽灵记录(ghost record)
定位表和索引使用的Page的更多相关文章
- Oracle索引梳理系列(五)- Oracle索引种类之表簇索引(cluster index)
版权声明:本文发布于http://www.cnblogs.com/yumiko/,版权由Yumiko_sunny所有,欢迎转载.转载时,请在文章明显位置注明原文链接.若在未经作者同意的情况下,将本文内 ...
- PE格式第七讲,重定位表
PE格式第七讲,重定位表 作者:IBinary出处:http://www.cnblogs.com/iBinary/版权所有,欢迎保留原文链接进行转载:) 一丶何为重定位(注意,不是重定位表格) 首先, ...
- MySQL InnoDB表和索引之聚簇索引与第二索引
MySQL InnoDB表和索引之聚簇索引与第二索引 By:授客QQ:1033553122 每个InnoDB表都有一个称之为聚簇索引(clustered index)的特殊索引,存储记录行数据.通常, ...
- SQL Server 内存优化表的索引设计
测试的版本:SQL Server 2017 内存优化表上可以创建哈希索引(Hash Index)和内存优化非聚集(NONCLUSTERED)索引,这两种类型的索引也是内存优化的,称作内存优化索引,和基 ...
- ORACLE表、索引和分区详解
ORACLE表.索引和分区 一.数据库表 每种类型的表都有不同的特性,分别应用与不同的领域 堆组织表 聚簇表(共三种) 索引组织表 嵌套表 临时表 外部表和对象表 1.行迁移 建表过程中可以指定以下两 ...
- Reverse Core 第二部分 - 16&17章 - 基址重定位表&.reloc节区
第16-17章 - 基址重定位表&.reloc节区 @date: 2016/11/31 @author: dlive 0x00 前言 这几天忙着挖邮箱漏洞,吃火锅,马上要被关禁闭,看书进度比较 ...
- Lucene学习之一:使用lucene为数据库表创建索引,并按关键字查询
最近项目中要用到模糊查询,开始研究lucene,期间走了好多弯路,总算实现了一个简单的demo. 使用的lucene jar包是3.6版本. 一:建立数据库表,并加上测试数据.数据库表:UserInf ...
- Sybase数据库收集表及其索引的统计信息
更新表及其索引的统计信息: update table statistics 表名 go update index statistics 表名 go 建议此操作在闲时操作.
- Oracle表与索引的分析及索引重建
1.分析表与索引(analyze 不会重建索引) analyze table tablename compute statistics 等同于 analyze table tablename co ...
随机推荐
- libnl概述
以下三个库都基于其核心库libnl: libnl-route:用于和Kernel中的Routing子系统交互. libnl-nf:用于和Kernel中的Netfilter子系统交互. libnl-ge ...
- [译]Vulkan教程(16)图形管道基础之总结
[译]Vulkan教程(16)图形管道基础之总结 Conclusion 总结 We can now combine all of the structures and objects from the ...
- 线段树模板加模板题POJ3468
POJ - 3468 整理了个新的线段树的模板,暑期集训的时候学长给的模板,每个节点单单存了自己所要维护的内容,还是少了点.导致在写pushdown的时候,len我会有点难写.所以就整理个新的模板. ...
- swoole怎么保持不掉线
正常情况下客户端中断TCP连接时,会发送一个FIN包,进行4次断开握手来通知服务器.但一些异常情况下,如客户端突然断电断网或者网络异常,服务器可能无法得知客户端已断开连接. 尤其是移动网络,TCP连接 ...
- IT兄弟连 HTML5教程 HTML5表单 小结及习题
小结 HTML表单提交的方法有get方法和post方法,get方法的作用是从指定的资源请求数据,post方法的作用是向指定的资源提交要被处理的数据.HTML表单一直都是Web的核心技术之一,有了它我们 ...
- linux配置LAMP(CentOS7.4 Apache2.4 PHP5.6)
1.安装Apache 这个就不手动安装了,直接上脚本执行 bash apache.sh 以下为脚本的内容: #!/bin/bashversion=`lsb_release -a|grep Releas ...
- Linux平台 Oracle 19c RAC安装Part3:DB配置
Linux平台 Oracle 19c RAC安装Part3:DB配置 四.DB(Database)配置 4.1 解压DB的安装包 4.2 DB软件配置 4.3 ASMCA创建磁盘组 4.4 DBCA建 ...
- zabbix snmp监控与主被模式
1.snmp基础介绍 snmp全称是简单网络管理协议 为什么要用? 路由器交换机无法安装agent程序,但是都提供snmp服务端, 我们可以使用zabbix的snmp方式监控snmp服务端的数据 2. ...
- activeMQ - how to install and run
apache activeMQ how to install and run https://www.cnblogs.com/lyxy/p/5969116.html
- Mac使用iTerm2 一键免密登录
iTerm是mac平台很好用的ssh管理工具,今天给大家介绍一种使用iTerm一键登陆服务器优雅的方式,这样就不需要每次连接服务器时都需要输入端口号.用户名.ip地址.密码(为了安全,服务器密码都好长 ...