我希望能够详细了解哪些数据库文件包含数据库中各种 HoBT(对齐和非对齐)的分配单元。
在我们开始为每个文件组创建多个数据文件之前,我一直使用的查询(见下文)一直对我有用,我只能弄清楚如何获得与文件组级别一样的细粒度。
select
SchemaName = sh.name,
TableName = t.name,
IndexName = i.name,
PartitionNumber = p.partition_number,
IndexID = i.index_id,
IndexDataspaceID = i.data_space_id,
AllocUnitDataspaceID = au.data_space_id,
PartitionRows = p.rows
from sys.allocation_units au
join sys.partitions p
on au.container_id = p.partition_id
join sys.indexes i
on i.object_id = p.object_id
and i.index_id = p.index_id
join sys.tables t
on p.object_id = t.object_id
join sys.schemas sh
on t.schema_id = sh.schema_id
where sh.name != 'sys'
and au.type = 2
union all
select
sh.name,
t.name,
i.name,
p.partition_number,
i.index_id,
i.data_space_id, …
Run Code Online (Sandbox Code Playgroud)