20 lines
758 B
SQL
20 lines
758 B
SQL
/*
|
|
Check table compression on all tables (indexes / partitions really) of the current db
|
|
|
|
24.12.2024, TSC
|
|
*/
|
|
--heap tables
|
|
SELECT [t].[name] AS [Table], [p].[partition_number] AS [Partition],
|
|
[p].[data_compression_desc] AS [Compression]
|
|
FROM [sys].[partitions] AS [p]
|
|
INNER JOIN sys.tables AS [t] ON [t].[object_id] = [p].[object_id]
|
|
WHERE [p].[index_id] in (0,1)
|
|
|
|
--non heap tables
|
|
SELECT [t].[name] AS [Table], [i].[name] AS [Index],
|
|
[p].[partition_number] AS [Partition],
|
|
[p].[data_compression_desc] AS [Compression]
|
|
FROM [sys].[partitions] AS [p]
|
|
INNER JOIN sys.tables AS [t] ON [t].[object_id] = [p].[object_id]
|
|
INNER JOIN sys.indexes AS [i] ON [i].[object_id] = [p].[object_id] AND [i].[index_id] = [p].[index_id]
|
|
WHERE [p].[index_id] > 1 |