定位表和索引使用的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 ...
随机推荐
- mysql 事务四要素杂谈
事务四要素 对于数据库来说,并发性和准确性是数据库需要权衡的两个点. 类似于我们的应用系统,又要要性能还要要准确. 数据准确性这一条来说,最好的控制就是串行化,都别急,一个一个来.这样数据就没问题了. ...
- 从数据表字段 float 和 double 说起
今天在公司讨论项目重构的问题时,公司的 DBA 针对表中的字段大概介绍了一下 float 和 double 的存储方式.然后,我发现这个问题又回到了浮点数类型在内存中的存储方式,即 IEEE 对浮点数 ...
- HttpModules配置事项
前沿:还是那句话 ASP.NET管道,浏览器 - isAPI32.dll - HttpModules - HttpHandler - 返回客户端Web.Config:<httpModules&g ...
- http请求post,文件导出兼容IE10+
1.post的方法里要加responseType: 'blob'参数,不然下载的excel会乱码 2.使用{type: "application/vnd.ms-excel"}的写法 ...
- js的try catch使用心得
1 try catch的使用,永远应该放在你的控制范围之内,而不应该防范未知的错误.也就是说你很清楚知道这里是有可能”出错“的,而且你很清楚知道什么前提下会出错,你就是要故意利用报错信息来区分错误 ...
- Python计算美国总统的身高并实现数据可视化
代码如下: import numpy as np import pandas as pd import matplotlib.pyplot as plt data=pd.read_csv('presi ...
- JS 逻辑
JS 逻辑 Boolean(逻辑)对象用于将非逻辑值转换为逻辑值(true 或者 false). Boolean 对象 您可以将 Boolean 对象理解为一个产生逻辑值的对象包装器. Boolean ...
- DOM HTML
DOM HTML HTML DOM 允许 JavaScript 改变 HTML 元素的内容. 改变 HTML 输出流 JavaScript 能够创建动态的 HTML 内容: 今天的日期是: Tue J ...
- 20180918 begin
20180918-20190717 风 雅 颂(305,每天一首): 诗经鉴赏, 180918-1030 魔鬼经济学 <唐宋词十七讲>叶嘉莹<最美的宋词> 布谷鸟<诗境浅 ...
- Linux CentOS 6.5 卸载、安装JDK1.8
卸载系统自带的jdk 1. 查询系统是否已经安装了jdk rpm -qa|grep java 2. 卸载已安装的jdk, 系统可能会自带多个jdk版本, 按需卸载 rpm -e --nodeps ja ...