我用ROW和PAGE方法压缩了我的表。在压缩类型向导中,它显示正确的状态。但是,当我尝试从sys.partitions
读取状态时,会将某些表保留为NONE。令人困惑的是,状态在2个视图中是不同的。
我已经尝试过多次将其更改为“无”,然后再次尝试将其压缩,但是没有运气。
SELECT DISTINCT
s.name AS schma,
t.name,
p.rows,
p.data_compression_desc,
'ALTER TABLE [' +s.name+ '].['+t.name+'] REBUILD PARTITION = ALL WITH (DATA_COMPRESSION = ROW)'
FROM sys.tables t
LEFT JOIN sys.indexes i
ON t.object_id = i.object_id
JOIN sys.schemas s
ON t.schema_id = s.schema_id
LEFT JOIN sys.partitions p
ON i.index_id = p.index_id
AND t.object_id = p.object_id
WHERE t.type = 'U'
AND p.data_compression_desc = 'NONE'
ORDER BY p.rows DESC```
How could I ensure about the method of compression.