Skip to content

Commit 20e8dd9

Browse files
authored
non partitioned indexes
1 parent 170ce89 commit 20e8dd9

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

QueryTemplates/Common Scripts/partitions-stats.sql

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,31 @@ ORDER BY
4747
ObjectName,
4848
IndexID,
4949
PartitionNumber;
50+
51+
52+
53+
54+
--non-partitioned tables/indexes
55+
SELECT
56+
SCHEMA_NAME(o.schema_id) AS SchemaName,
57+
OBJECT_NAME(p.object_id) AS ObjectName,
58+
i.name AS IndexName,
59+
p.index_id AS IndexID,
60+
p.partition_number AS PartitionNumber,
61+
fg.name AS FileGroupName,
62+
p.[rows] AS Rows,
63+
p.[data_compression_desc] AS [Compression]
64+
FROM sys.partitions AS p
65+
JOIN sys.indexes AS i
66+
ON i.object_id = p.object_id
67+
AND i.index_id = p.index_id
68+
JOIN sys.data_spaces AS ds
69+
ON ds.data_space_id = i.data_space_id
70+
JOIN sys.filegroups AS fg
71+
ON fg.data_space_id = i.data_space_id
72+
WHERE
73+
OBJECTPROPERTY(p.object_id, 'ISMSShipped') = 0
74+
ORDER BY
75+
ObjectName,
76+
IndexID,
77+
PartitionNumber;

0 commit comments

Comments
 (0)