You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**partition_id**|**bigint**|Indicates the partition ID. Is unique within a database.|
33
+
|**hobt_id**|**bigint**|ID of the heap or B-tree index (hobt) for the table that has this columnstore index.|
34
+
|**column_id**|**int**|ID of the columnstore column.|
35
+
|**segment_id**|**int**|ID of the column segment. For backward compatibility, the column name continues to be called segment_id even though this is the rowgroup ID. You can uniquely identify a segment using <hobt_id, partition_id, column_id>, <segment_id>. |
36
+
|**version**|**int**|Version of the column segment format.|
37
+
|**encoding_type**|**int**|Type of encoding used for that segment:<br /><br /> 1 = VALUE_BASED - non-string/binary with no dictionary (similar to 4 with some internal variations)<br /><br /> 2 = VALUE_HASH_BASED - non-string/binary column with common values in dictionary<br /><br /> 3 = STRING_HASH_BASED - string/binary column with common values in dictionary<br /><br /> 4 = STORE_BY_VALUE_BASED - non-string/binary with no dictionary<br /><br /> 5 = STRING_STORE_BY_VALUE_BASED - string/binary with no dictionary<br /><br /> All encodings take advantage of bit-packing and run-length encoding when possible. |
38
+
|**row_count**|**int**|Number of rows in the row group.|
39
+
|**has_nulls**|**int**|1 if the column segment has null values.|
40
+
|**base_id**|**bigint**|Base value ID if encoding type 1 is being used. If encoding type 1 is not being used, base_id is set to 1.|
41
+
|**magnitude**|**float**|Magnitude if encoding type 1 is being used. If encoding type 1 is not being used, magnitude is set to 1.|
42
+
|**primary__dictionary_id**|**int**| ID of primary dictionary. A non-zero value points to the local dictionary for this column in the current segment (i.e. the rowgroup). A value of -1 indicates that there is no local dictionary for this segment. |
43
+
|**secondary_dictionary_id**|**int**| ID of secondary dictionary. A non-zero value points to the local dictionary for this column in the current segment (i.e. the rowgroup). A value of -1 indicates that there is no local dictionary for this segment. |
44
+
|**min_data_id**|**bigint**|Minimum data ID in the column segment.|
45
+
|**max_data_id**|**bigint**|Maximum data ID in the column segment.|
46
+
|**null_value**|**bigint**|Value used to represent nulls.|
47
+
|**on_disk_size**|**bigint**|Size of segment in bytes.|
48
+
|**pdw_node_id**|**int**|Unique identifier of a [!INCLUDE[ssSDW](../../includes/sssdw-md.md)]node. |
49
+
49
50
## Examples: [!INCLUDE[ssSDWfull](../../includes/sssdwfull-md.md)] and [!INCLUDE[ssPDW](../../includes/sspdw-md.md)]
50
-
The following query returns information about segments of a columnstore index.
Join sys.pdw_nodes_column_store_segments with other system tables to determine the number of columnstore segments per logical table.
53
+
54
+
```sql
55
+
SELECTsm.nameas schema_nm
56
+
, tb.nameas table_nm
57
+
, nc.nameas col_nm
58
+
, nc.column_id
59
+
, COUNT(*) as segment_count
60
+
FROM sys.[schemas] sm
61
+
JOIN sys.[tables] tb ON sm.[schema_id] = tb.[schema_id]
62
+
JOIN sys.[pdw_table_mappings] mp ON tb.[object_id] = mp.[object_id]
63
+
JOIN sys.[pdw_nodes_tables] nt ON nt.[name] = mp.[physical_name]
64
+
JOIN sys.[pdw_nodes_partitions] np ON np.[object_id] = nt.[object_id]
65
+
AND np.[pdw_node_id] = nt.[pdw_node_id]
66
+
AND np.[distribution_id] = nt.[distribution_id]
67
+
JOIN sys.[pdw_nodes_columns] nc ON np.[object_id] = nc.[object_id]
68
+
AND np.[pdw_node_id] = nc.[pdw_node_id]
69
+
AND np.[distribution_id] = nc.[distribution_id]
70
+
JOIN sys.[pdw_nodes_column_store_segments] rg ON rg.[partition_id] = np.[partition_id]
71
+
AND rg.[pdw_node_id] = np.[pdw_node_id]
72
+
AND rg.[distribution_id] = np.[distribution_id]
73
+
AND rg.[column_id] = nc.[column_id]
74
+
GROUP BYsm.name
75
+
, tb.name
76
+
, nc.name
77
+
, nc.column_id
78
+
ORDER BY table_nm
79
+
, nc.column_id
80
+
, sm.name
81
+
```
82
+
81
83
## Permissions
82
84
Requires **VIEW SERVER STATE** permission.
83
-
85
+
84
86
## See Also
85
87
[SQL Data Warehouse and Parallel Data Warehouse Catalog Views](../../relational-databases/system-catalog-views/sql-data-warehouse-and-parallel-data-warehouse-catalog-views.md)
86
88
[CREATE COLUMNSTORE INDEX (Transact-SQL)](../../t-sql/statements/create-columnstore-index-transact-sql.md)
0 commit comments