Can someone tell me if there is any sys table where I can find information about the size of XML indexes (both primary and secondary) in SQL Server?
So far I've been using this script to check for the size of an index:
SELECT
t.name AS TableName
, i.name as IndexName
, SUM(a.total_pages) * 8 / 1024.00 as SizeInMB
FROM sys.tables t
JOIN sys.indexes i ON t.object_id = i.object_id
JOIN sys.partitions p ON i.object_id = p.object_id AND i.index_id = p.index_id
JOIN sys.allocation_units a ON p.partition_id = a.container_id
JOIN sys.database_files df on df.data_space_id=a.data_space_id
GROUP BY t.name, i.name
but it seems that xml indexes don't have a partition_id allocated on creation.
And I also haven't found anything regarding a sys table or dmv for this particular information on msdn.