1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| select FILEGROUP_NAME(au.data_space_id) as file_group
, o.name
, i.index_id
, i.name as index_name
, au.partition_number
, au.size_MB
, case when i.data_space_id > 65000 then 'Y' else 'N' end IsPartitionedTable
from (
select object_id, index_id, partition_number, data_space_id
, convert(numeric(10,2)
, SUM(in_row_data_page_count
+ lob_used_page_count
+ row_overflow_used_page_count) * 8/1024.0) size_MB
from sys.allocation_units au
join sys.dm_db_partition_stats ps
on au.container_id = ps.partition_id and au.type=1
group by object_id, index_id, partition_number, data_space_id
) au
join sys.indexes i
on i.object_id = au.object_id and i.index_id = au.index_id
join sys.all_objects o
on i.[object_id] = o.[object_id] and o.type='U'
order by 1,2,3,4
|