Database Reference
In-Depth Information
Figure
34-19
shows the partial output of a query from Listing 34-12. Column 8, which does not have column
name displayed, represents the
OrderId
column, which is a part of the clustered index and has not been explicitly
defined in the columnstore index.
Figure 34-19.
sys.column_store_segments
output
The columns in the output represent the following:
column_id
is the ID of a column in the index, which you can join with
the
sys.index_columns
view. As you have seen, only columns that are explicitly included
in an index have corresponding
sys.index_columns
rows.
partition_id
references the partition to which a row group (and, therefore, a segment)
belongs. You can use it in a join with
sys.partitions
view to obtain
object_id
of the index.
segment_id
is the ID of the segment, which is basically the ID of a row group. The first
segment in partition has ID of 0.
version
represents a columnstore segment format. Both, SQL Server 2012 and 2014 return
1 as its value.
encoding_type
represents the encoding used for this segment. It can have one of the
following four values:
Value-based encoding has
encoding_type = 1
Dictionary encoding of non-strings has
encoding_type = 2
Dictionary encoding of string values has
encoding_type = 3
No encoding is used has
encoding_type = 4
row_count
represents number of rows in the segment.
has_null
indicates if the data has null values.