定位表和索引使用的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 ...
随机推荐
- salt-api 获取服务器信息,minion批量执行cmd命令
import requests import json try: import cookielib except: import http.cookiejar as cookielib # 使用url ...
- 上手Neo4j
Neo4j是什么 软件安装及常用的配置选项介绍 下载 wget https://neo4j.com/artifact.php?name=neo4j-community-3.5.3-unix.tar.g ...
- 程序员修神之路--redis做分布式锁可能不那么简单
菜菜哥,复联四上映了,要不要一起去看看? 又想骗我电影票,对不对? 呵呵,想去看了叫我呀 看来你工作不饱和呀 哪有,这两天我刚基于redis写了一个分布式锁,很简单 不管你基于什么做分布式锁,你觉得很 ...
- Windows下第一个驱动程序
Windows内核分析索引目录:https://www.cnblogs.com/onetrainee/p/11675224.html 参考下面博客: VS2017搭建驱动开发环境WDK :https: ...
- Mybatis+Spring框架整合
1.整合思路 1.SqlSessionFactory对象应该放到spring容器中作为单例存在. 2.传统dao的开发方式中,应该从spring容器中获得sqlsession对象. 3.Mapper代 ...
- Winform中使用DevExpress的CheckEdit控件实现多选条件搜索
场景 Winform控件-DevExpress18下载安装注册以及在VS中使用: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/1 ...
- pecl安装和卸载示例
比如安装MongoDB扩展 命令行下输入: [#] /usr/local/php/bin/pecl install mongodb ......嗒吧嗒吧一大堆输出后 Build process com ...
- 面试题:python 中 staticmethod 和 classmethod有什么区别
面试中经常会问到staticmethod 和 classmethod有什么区别? 首先看下官方的解释: staticmethod: class staticmethod staticmethod(fu ...
- php反序列化漏洞绕过魔术方法 __wakeup
0x01 前言 前天学校的ctf比赛,有一道题是关于php反序列化漏洞绕过wakeup,最后跟着大佬们学到了一波姿势.. 0x02 原理 序列化与反序列化简单介绍 序列化:把复杂的数据类型压缩到一个字 ...
- SAP OB52会计年度变式
Var.(Posting Period Variant) 记帐区间变式,每个公司代码对应一个记帐期间变式,多个公司代码可以使用一个相同的记帐期间变式 A(Performance Assistant) ...