Table of Contents

Class QueryStoreSchema.QueryStoreQuery

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

sys.query_store_query (Transact-SQL)

Applies to: √ SQL Server 2016 (13.x) and later √ Azure SQL DatabaseAzure SQL Managed InstanceAzure Synapse Analytics

Contains information about the query and its associated overall aggregated runtime execution statistics.


See sys.query_store_query.

[Table(Schema = "sys", Name = "query_store_query", IsView = true)]
public class QueryStoreSchema.QueryStoreQuery
Inheritance
QueryStoreSchema.QueryStoreQuery
Inherited Members
Extension Methods

Properties

AvgBindCpuTime

avg_bind_cpu_time NULL float

Binding statistics.
[Column("avg_bind_cpu_time")]
[Nullable]
public double? AvgBindCpuTime { get; set; }

Property Value

double?

AvgBindDuration

avg_bind_duration NULL float

Binding statistics in microseconds.
[Column("avg_bind_duration")]
[Nullable]
public double? AvgBindDuration { get; set; }

Property Value

double?

AvgCompileDuration

avg_compile_duration NULL float

Compilation statistics in microseconds.
[Column("avg_compile_duration")]
[Nullable]
public double? AvgCompileDuration { get; set; }

Property Value

double?

AvgCompileMemoryKb

avg_compile_memory_kb NULL float

Compile memory statistics.
[Column("avg_compile_memory_kb")]
[Nullable]
public double? AvgCompileMemoryKb { get; set; }

Property Value

double?

AvgOptimizeCpuTime

avg_optimize_cpu_time NULL float

Optimization statistics in microseconds.
[Column("avg_optimize_cpu_time")]
[Nullable]
public double? AvgOptimizeCpuTime { get; set; }

Property Value

double?

AvgOptimizeDuration

avg_optimize_duration NULL float

Optimization statistics in microseconds.
[Column("avg_optimize_duration")]
[Nullable]
public double? AvgOptimizeDuration { get; set; }

Property Value

double?

BatchSqlHandle

batch_sql_handle NULL varbinary(64)

ID of the statement batch the query is part of. Populated only if query references temporary tables or table variables.
[Column("batch_sql_handle")]
[Nullable]
public byte[]? BatchSqlHandle { get; set; }

Property Value

byte[]

ContextSettingsID

context_settings_id NOT NULL bigint

Foreign key. Joins to sys.query_context_settings (Transact-SQL).
[Column("context_settings_id")]
[NotNull]
public long ContextSettingsID { get; set; }

Property Value

long

CountCompiles

count_compiles NULL bigint

Compilation statistics.
[Column("count_compiles")]
[Nullable]
public long? CountCompiles { get; set; }

Property Value

long?

InitialCompileStartTime

initial_compile_start_time NOT NULL datetimeoffset

Compile start time.
[Column("initial_compile_start_time")]
[NotNull]
public DateTimeOffset InitialCompileStartTime { get; set; }

Property Value

DateTimeOffset

IsClouddbInternalQuery

is_clouddb_internal_query NULL bit

Always 0 in SQL Server on-premises.
[Column("is_clouddb_internal_query")]
[Nullable]
public bool? IsClouddbInternalQuery { get; set; }

Property Value

bool?

IsInternalQuery

is_internal_query NOT NULL bit

The query was generated internally.
[Column("is_internal_query")]
[NotNull]
public bool IsInternalQuery { get; set; }

Property Value

bool

LastBindCpuTime

last_bind_cpu_time NULL bigint

Binding statistics.
[Column("last_bind_cpu_time")]
[Nullable]
public long? LastBindCpuTime { get; set; }

Property Value

long?

LastBindDuration

last_bind_duration NULL bigint

Binding statistics.
[Column("last_bind_duration")]
[Nullable]
public long? LastBindDuration { get; set; }

Property Value

long?

LastCompileBatchOffsetEnd

last_compile_batch_offset_end NULL bigint

Information that can be provided to sys.dm_exec_sql_text along with last_compile_batch_sql_handle.
[Column("last_compile_batch_offset_end")]
[Nullable]
public long? LastCompileBatchOffsetEnd { get; set; }

Property Value

long?

LastCompileBatchOffsetStart

last_compile_batch_offset_start NULL bigint

Information that can be provided to sys.dm_exec_sql_text along with last_compile_batch_sql_handle.
[Column("last_compile_batch_offset_start")]
[Nullable]
public long? LastCompileBatchOffsetStart { get; set; }

Property Value

long?

LastCompileBatchSqlHandle

last_compile_batch_sql_handle NULL varbinary(64)

Handle of the last SQL batch in which query was used last time. It can be provided as input to sys.dm_exec_sql_text (Transact-SQL) to get the full text of the batch.
[Column("last_compile_batch_sql_handle")]
[Nullable]
public byte[]? LastCompileBatchSqlHandle { get; set; }

Property Value

byte[]

LastCompileDuration

last_compile_duration NULL bigint

Compilation statistics in microseconds.
[Column("last_compile_duration")]
[Nullable]
public long? LastCompileDuration { get; set; }

Property Value

long?

LastCompileMemoryKb

last_compile_memory_kb NULL bigint

Compile memory statistics.
[Column("last_compile_memory_kb")]
[Nullable]
public long? LastCompileMemoryKb { get; set; }

Property Value

long?

LastCompileStartTime

last_compile_start_time NULL datetimeoffset

Compile start time.
[Column("last_compile_start_time")]
[Nullable]
public DateTimeOffset? LastCompileStartTime { get; set; }

Property Value

DateTimeOffset?

LastExecutionTime

last_execution_time NULL datetimeoffset

Last execution time refers to the last end time of the query/plan.
[Column("last_execution_time")]
[Nullable]
public DateTimeOffset? LastExecutionTime { get; set; }

Property Value

DateTimeOffset?

LastOptimizeCpuTime

last_optimize_cpu_time NULL bigint

Optimization statistics.
[Column("last_optimize_cpu_time")]
[Nullable]
public long? LastOptimizeCpuTime { get; set; }

Property Value

long?

LastOptimizeDuration

last_optimize_duration NULL bigint

Optimization statistics.
[Column("last_optimize_duration")]
[Nullable]
public long? LastOptimizeDuration { get; set; }

Property Value

long?

MaxCompileMemoryKb

max_compile_memory_kb NULL bigint

Compile memory statistics.
[Column("max_compile_memory_kb")]
[Nullable]
public long? MaxCompileMemoryKb { get; set; }

Property Value

long?

Object

objects (sys.objects)

[Association(ThisKey = "ObjectID", OtherKey = "ObjectID", CanBeNull = false)]
public ObjectSchema.Object Object { get; set; }

Property Value

ObjectSchema.Object

ObjectID

object_id NULL bigint

ID of the database object that the query is part of (stored procedure, trigger, CLR UDF/UDAgg, etc.). 0 if the query isn't executed as part of a database object (ad hoc query).
[Column("object_id")]
[Nullable]
public long? ObjectID { get; set; }

Property Value

long?

QueryHash

query_hash NOT NULL binary(8)

Zobrist hash over the shape of the individual query, based on the bound (input) logical query tree. Query hints aren't included as part of the hash.
[Column("query_hash")]
[NotNull]
public byte[] QueryHash { get; set; }

Property Value

byte[]

QueryID

query_id NOT NULL bigint

Primary key.
[Column("query_id")]
[NotNull]
public long QueryID { get; set; }

Property Value

long

QueryParameterizationType

query_parameterization_type NOT NULL tinyint

Type of parameterization:

0 - None
1 - User
2 - Simple
3 - Forced
[Column("query_parameterization_type")]
[NotNull]
public byte QueryParameterizationType { get; set; }

Property Value

byte

QueryParameterizationTypeDesc

query_parameterization_type_desc NULL nvarchar(60)

Textual description for the parameterization type.
[Column("query_parameterization_type_desc")]
[Nullable]
public string? QueryParameterizationTypeDesc { get; set; }

Property Value

string

QueryTextID

query_text_id NOT NULL bigint

Foreign key. Joins to sys.query_store_query_text (Transact-SQL)
[Column("query_text_id")]
[NotNull]
public long QueryTextID { get; set; }

Property Value

long