sys.column_store_segments (Transact-SQL)

对于 columnstore 索引中的每列包括一行。

适用范围:SQL Server(SQL Server 2012 到当前版本)。

列名称

数据类型

说明

partition_id

bigint

指示分区 ID。 在数据库中是唯一的。

hobt_id

bigint

具有此 columnstore 索引的表的堆或 B 树 (hobt) 的 ID。

column_id

int

columnstore 列的 ID。

segment_id

int

列段的 ID。

version

int

列段格式的版本。

encoding_type

int

该段使用的编码类型。

row_count

int

行组中的行数。

has_nulls

int

1 如果列段具有 Null 值。

base_id

bigint

使用编码类型 1 时的基值 ID。如果未使用编码类型 1,则 base_id 设置为 1。

magnitude

float

使用编码类型 1 时的量级。如果未使用编码类型 1,则量级设置为 1。

primary__dictionary_id

int

主字典的 ID。

secondary_dictionary_id

int

辅助字典的 ID。 如果没有辅助字典,则返回 -1。

min_data_id

bigint

列段中的最小数据 ID。

max_data_id

bigint

列段中的最大数据 ID。

null_value

bigint

用于表示 Null 的值。

on_disk_size

bigint

段大小(字节)。

备注

以下查询返回有关列存储索引各段的信息。

SELECT i.name, p.object_id, p.index_id, i.type_desc, 
    COUNT(*) AS number_of_segments
FROM sys.column_store_segments AS s 
INNER JOIN sys.partitions AS p 
    ON s.hobt_id = p.hobt_id 
INNER JOIN sys.indexes AS i 
    ON p.object_id = i.object_id
WHERE i.type = 6
GROUP BY i.name, p.object_id, p.index_id, i.type_desc ;
GO

权限

所有列都要求至少对表具有 VIEW DEFINITION 权限。 以下各列将返回 Null,除非用户也具有 SELECT 权限:has_nulls、base_id、magnitude、min_data_id、max_data_id 和 null_value。

目录视图中仅显示用户拥有的安全对象的元数据,或用户对其拥有某些权限的安全对象的元数据。 有关详细信息,请参阅元数据可见性配置

请参阅

参考

对象目录视图 (Transact-SQL)

目录视图 (Transact-SQL)

sys.columns (Transact-SQL)

sys.all_columns (Transact-SQL)

sys.computed_columns (Transact-SQL)

sys.column_store_dictionaries (Transact-SQL)

概念

查询 SQL Server 系统目录常见问题

列存储索引简介

列存储索引简介