Share via


sys.pdw_nodes_column_store_segments (Transact-SQL)

適用於:Azure Synapse AnalyticsAnalytics Platform System (PDW)

包含資料行存放區索引中每個資料行的資料列。

資料行名稱 資料類型 描述
partition_id bigint 表示分割區識別碼。 在資料庫內是唯一的。
hobt_id bigint 具有此資料行存放區索引之資料表的堆積或 B 型樹狀結構索引 (hobt) 識別碼。
column_id int 資料行存放區資料行的識別碼。
segment_id int 資料行區段的識別碼。 為了保持回溯相容性,即使這是資料列群組識別碼,仍會繼續呼叫資料行名稱segment_id。 您可以使用hobt_id、partition_id、column_id、 < segment_id >> 來唯一識別區段 < 。
version int 資料行區段格式的版本。
encoding_type int 用於該區段的編碼類型:

1 = VALUE_BASED - 沒有字典的非字串/二進位檔(類似于 4,具有一些內部變化)

2 = VALUE_HASH_BASED - 字典中具有通用值的非字串/二進位資料行

3 = STRING_HASH_BASED - 字典中具有一般值的字串/二進位資料行

4 = STORE_BY_VALUE_BASED - 沒有字典的非字串/二進位

5 = STRING_STORE_BY_VALUE_BASED - 沒有字典的字串/二進位

所有編碼都盡可能利用位封裝和運行長度編碼。
row_count int 資料列群組中的資料列數目。
has_nulls int 如果資料行區段具有 Null 值,則為 1。
base_id bigint 如果使用編碼類型 1,則為基底值識別碼。 如果未使用編碼類型 1,base_id會設定為 1。
大小 float 如果使用編碼類型 1,則為大小。 如果未使用編碼類型 1,大小會設定為 1。
primary__dictionary_id int 主要字典的識別碼。 非零值會指向目前區段中此資料行的本機字典(亦即資料列群組)。 值為 -1 表示此區段沒有本機字典。
secondary_dictionary_id int 次要字典的識別碼。 非零值會指向目前區段中此資料行的本機字典(亦即資料列群組)。 值為 -1 表示此區段沒有本機字典。
min_data_id bigint 資料行區段中的資料識別碼下限。
max_data_id bigint 資料行區段中的資料識別碼上限。
null_value bigint 用來表示 Null 的值。
on_disk_size bigint 以位元組為單位的區段大小。
pdw_node_id int Azure Synapse Analytics 節點的唯一識別碼。

範例:Azure Synapse Analytics 和 Analytics Platform System (PDW)

將sys.pdw_nodes_column_store_segments與其他系統資料表聯結,以判斷每個邏輯資料表的資料行存放區區段數目。

SELECT  sm.name           as schema_nm
,       tb.name           as table_nm
,       nc.name           as col_nm
,       nc.column_id
,       COUNT(*)          as segment_count
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.[pdw_nodes_partitions] np     ON  np.[object_id]          = nt.[object_id]
                                          AND np.[pdw_node_id]        = nt.[pdw_node_id]
                                          AND np.[distribution_id]    = nt.[distribution_id]
JOIN    sys.[pdw_nodes_columns] nc        ON  np.[object_id]          = nc.[object_id]
                                          AND np.[pdw_node_id]        = nc.[pdw_node_id]
                                          AND np.[distribution_id]    = nc.[distribution_id]
JOIN    sys.[pdw_nodes_column_store_segments] rg  ON  rg.[partition_id]         = np.[partition_id]
                                                      AND rg.[pdw_node_id]      = np.[pdw_node_id]
                                                      AND rg.[distribution_id]  = np.[distribution_id]
                                                      AND rg.[column_id]        = nc.[column_id]
GROUP BY    sm.name
,           tb.name
,           nc.name
,           nc.column_id  
ORDER BY    table_nm
,           nc.column_id
,           sm.name ;

權限

需要 VIEW SERVER STATE 權限。

另請參閱

Azure Synapse Analytics 和平行處理資料倉儲目錄檢視
CREATE COLUMNSTORE INDEX (Transact-SQL)
sys.pdw_nodes_column_store_row_groups (Transact-SQL)
sys.pdw_nodes_column_store_dictionaries (Transact-SQL)