This commit is contained in:
DCrawford 2021-10-29 16:16:29 -04:00 коммит произвёл GitHub
Родитель 4d00d089b9
Коммит b81867e583
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 15 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,15 @@
SELECT sm.name as [Schema_Name]
, tb.[name] AS [logical_table_name]
, sum(rg.[total_rows]) AS [total_CCI_rows]
FROM sys.[schemas] sm
JOIN sys.[tables] tb ON sm.[schema_id] = tb.[schema_id]
JOIN sys.[pdw_table_mappings] mp ON tb.[object_id] = mp.[object_id]
JOIN sys.[pdw_nodes_tables] nt ON nt.[name] = mp.[physical_name]
JOIN sys.[dm_pdw_nodes_db_column_store_row_group_physical_stats] rg ON rg.[object_id] = nt.[object_id]
AND rg.[pdw_node_id] = nt.[pdw_node_id]
AND rg.[distribution_id] = nt.[distribution_id]
GROUP BY sm.name, tb.name, rg.[object_id], index_id
HAVING sum(rg.[total_rows]) < 60000000 -- Show only CCI tables with less than 60m records
;
-- https://docs.microsoft.com/en-us/azure/synapse-analytics/sql-data-warehouse/sql-data-warehouse-tables-index#optimizing-clustered-columnstore-indexes