定位表和索引使用的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 ...
随机推荐
- 【西北师大-2108Java】第十一次作业成绩汇总
[西北师大-2108Java]第十一次作业成绩汇总 作业题目 面向对象程序设计(JAVA) 第13周学习指导及要求 实验目的与要求 (1)掌握事件处理的基本原理,理解其用途: (2)掌握AWT事件模型 ...
- 【使用篇二】Quartz自动化配置集成(17)
出处:https://www.jianshu.com/p/49133c107143 定时任务在企业项目比较常用到,几乎所有的项目都会牵扯该功能模块,定时任务一般会处理指定时间点执行某一些业务逻辑.间隔 ...
- Flink概述| 配置
流处理技术的演变 在开源世界里,Apache Storm项目是流处理的先锋.Storm提供了低延迟的流处理,但是它为实时性付出了一些代价:很难实现高吞吐,并且其正确性没能达到通常所需的水平,换句话说, ...
- 最强Linux shell工具Oh My Zsh 指南
引言 笔者已经使用zsh一年多了,发现这个东东的功能太强大了.接下来,给大家推荐一下. 以下是oh-my-zsh部分功能 命令验证 在所有正在运行的shell中共享命令历史记录 拼写纠正 主题提示(A ...
- Springboot关于tomcat容器配置、三大组件配置、拦截器配置
原文地址:http://www.javayihao.top/detail/172 1.tomcat配置 Springboot默认使用的就是嵌入式servlet容器即tomcat,对于web项目,如果使 ...
- 好用的js片段收藏
1.判断浏览器信息,如果是手机,就跳到手机页面 if(/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) { wind ...
- node http 模块 常用知识点记录
关于 node,总是断断续续的学一点,也只能在本地自己模拟实战,相信总会有实战的一天~~ http 作为服务端,开启服务,处理路由,响应等 http 作为客户端,发送请求 http.https.htt ...
- ASP.NET Core部署系列二:发布到CentOS上
前言: 在上一节中,通过一系列的步骤,已经将项目部署到IIS上,虽然遇到了一些问题,但最终解决并成功运行了.而在这一节中,将尝试通过linux系统的环境下,部署项目,实现Net Core跨平台的亮点. ...
- OpenCV:图像的裁剪
import cv2 import matplotlib.pyplot as plt def show(image): plt.imshow(image) plt.axis('off') plt.sh ...
- Python 定时任务的实现方式
本文转载自: https://lz5z.com/Python%E5%AE%9A%E6%97%B6%E4%BB%BB%E5%8A%A1%E7%9A%84%E5%AE%9E%E7%8E%B0%E6%96% ...