Table of Contents

Class ObjectSchema.ColumnStoreSegment

Namespace
LinqToDB.Tools.DataProvider.SqlServer.Schemas
Assembly
linq2db.Tools.dll

sys.column_store_segments (Transact-SQL)

Applies to: √ SQL Server 2012 (11.x) and later √ Azure SQL Managed Instance

Returns one row for each column segment in a columnstore index. There is one column segment per column per rowgroup. For example, a table with 10 rowgroups and 34 columns returns 340 rows.


See sys.column_store_segments.

[Table(Schema = "sys", Name = "column_store_segments", IsView = true)]
public class ObjectSchema.ColumnStoreSegment
Inheritance
ObjectSchema.ColumnStoreSegment
Inherited Members
Extension Methods

Properties

BaseID

base_id NULL 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.
[Column("base_id")]
[Nullable]
public long? BaseID { get; set; }

Property Value

long?

CollationID

collation_id NULL int

Applies to SQL Server 2022 (16.x) and later.
Current collation when the segment was created. Maps to an internal ID. Currently internal only and not for development.
[Column("collation_id")]
[Nullable]
public int? CollationID { get; set; }

Property Value

int?

ColumnID

column_id NULL int

ID of the columnstore column.
[Column("column_id")]
[Nullable]
public int? ColumnID { get; set; }

Property Value

int?

EncodingType

encoding_type NULL int

Type of encoding used for that segment:

1 = VALUE_BASED - non-string/binary with no dictionary (similar to 4 with some internal variations)

2 = VALUE_HASH_BASED - non-string/binary column with common values in dictionary

3 = STRING_HASH_BASED - string/binary column with common values in dictionary

4 = STORE_BY_VALUE_BASED - non-string/binary with no dictionary

5 = STRING_STORE_BY_VALUE_BASED - string/binary with no dictionary

For more information, see the [Remarks](#remarks) section.
[Column("encoding_type")]
[Nullable]
public int? EncodingType { get; set; }

Property Value

int?

HasNulls

has_nulls NULL int

1 if the column segment has null values.
[Column("has_nulls")]
[Nullable]
public int? HasNulls { get; set; }

Property Value

int?

HoBTID

hobt_id NULL bigint

ID of the heap or B-tree index (HoBT) for the table that has this columnstore index.
[Column("hobt_id")]
[Nullable]
public long? HoBTID { get; set; }

Property Value

long?

Magnitude

magnitude NULL float

Magnitude if encoding type 1 is being used. If encoding type 1 is not being used, magnitude is set to -1.
[Column("magnitude")]
[Nullable]
public double? Magnitude { get; set; }

Property Value

double?

MaxDataID

max_data_id NULL bigint

Maximum data ID in the column segment.
[Column("max_data_id")]
[Nullable]
public long? MaxDataID { get; set; }

Property Value

long?

MaxDeepData

max_deep_data NULL varbinary(18)

Applies to SQL Server 2022 (16.x) and later.
Used for segment elimination.1 For internal use only.
[Column("max_deep_data")]
[Nullable]
public byte[]? MaxDeepData { get; set; }

Property Value

byte[]

MinDataID

min_data_id NULL bigint

Minimum data ID in the column segment.
[Column("min_data_id")]
[Nullable]
public long? MinDataID { get; set; }

Property Value

long?

MinDeepData

min_deep_data NULL varbinary(18)

Applies to SQL Server 2022 (16.x) and later.
Used for segment elimination.1 For internal use only.
[Column("min_deep_data")]
[Nullable]
public byte[]? MinDeepData { get; set; }

Property Value

byte[]

NullValue

null_value NULL bigint

Value used to represent nulls.
[Column("null_value")]
[Nullable]
public long? NullValue { get; set; }

Property Value

long?

OnDiskSize

on_disk_size NULL bigint

Size of segment in bytes.
[Column("on_disk_size")]
[Nullable]
public long? OnDiskSize { get; set; }

Property Value

long?

PartitionID

partition_id NULL bigint

Indicates the partition ID. Is unique within a database.
[Column("partition_id")]
[Nullable]
public long? PartitionID { get; set; }

Property Value

long?

PrimaryDictionaryID

primary_dictionary_id NULL int

A value of 0 represents the global dictionary. A value of -1 indicates that there is no global dictionary created for this column.
[Column("primary_dictionary_id")]
[Nullable]
public int? PrimaryDictionaryID { get; set; }

Property Value

int?

RowCount

row_count NULL int

Number of rows in the row group.
[Column("row_count")]
[Nullable]
public int? RowCount { get; set; }

Property Value

int?

SecondaryDictionaryID

secondary_dictionary_id NULL int

A non-zero value points to the local dictionary for this column in the current segment (for example, the rowgroup). A value of -1 indicates that there is no local dictionary for this segment.
[Column("secondary_dictionary_id")]
[Nullable]
public int? SecondaryDictionaryID { get; set; }

Property Value

int?

SegmentID

segment_id NULL int

ID of the rowgroup. 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>.
[Column("segment_id")]
[Nullable]
public int? SegmentID { get; set; }

Property Value

int?

Version

version NULL int

Version of the column segment format.
[Column("version")]
[Nullable]
public int? Version { get; set; }

Property Value

int?