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 Database √ Azure SQL Managed Instance √ Azure 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
Extension Methods

Properties

AvgBindCpuTime

Binding statistics.
Note: Azure Synapse Analytics will always return zero (0).

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

Property Value

double?

AvgBindDuration

Binding statistics in microseconds.
Note: Azure Synapse Analytics will always return zero (0).

[Column("avg_bind_duration")]
[Nullable]
public double? AvgBindDuration { get; set; }

Property Value

double?

AvgCompileDuration

Compilation statistics in microseconds.

[Column("avg_compile_duration")]
[Nullable]
public double? AvgCompileDuration { get; set; }

Property Value

double?

AvgCompileMemoryKb

Compile memory statistics.
Note: Azure Synapse Analytics will always return zero (0).

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

Property Value

double?

AvgOptimizeCpuTime

Optimization statistics in microseconds.
Note: Azure Synapse Analytics will always return zero (0).

[Column("avg_optimize_cpu_time")]
[Nullable]
public double? AvgOptimizeCpuTime { get; set; }

Property Value

double?

AvgOptimizeDuration

Optimization statistics in microseconds.

[Column("avg_optimize_duration")]
[Nullable]
public double? AvgOptimizeDuration { get; set; }

Property Value

double?

BatchSqlHandle

ID of the statement batch the query is part of. Populated only if query references temporary tables or table variables.
Note: Azure Synapse Analytics will always return NULL.

[Column("batch_sql_handle")]
[Nullable]
public byte[]? BatchSqlHandle { get; set; }

Property Value

byte[]

ContextSettingsID

Foreign key. Joins to sys.query_context_settings (Transact-SQL).
Note: Azure Synapse Analytics will always return one (1).

[Column("context_settings_id")]
[NotNull]
public long ContextSettingsID { get; set; }

Property Value

long

CountCompiles

Compilation statistics.
Note: Azure Synapse Analytics will always return one (1).

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

Property Value

long?

InitialCompileStartTime

Compile start time.

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

Property Value

DateTimeOffset

IsClouddbInternalQuery

Always 0 in SQL Server on-premises.
Note: Azure Synapse Analytics will always return zero (0).

[Column("is_clouddb_internal_query")]
[Nullable]
public bool? IsClouddbInternalQuery { get; set; }

Property Value

bool?

IsInternalQuery

The query was generated internally.
Note: Azure Synapse Analytics will always return zero (0).

[Column("is_internal_query")]
[NotNull]
public bool IsInternalQuery { get; set; }

Property Value

bool

LastBindCpuTime

Binding statistics.
Note: Azure Synapse Analytics will always return zero (0).

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

Property Value

long?

LastBindDuration

Binding statistics.
Note: Azure Synapse Analytics will always return zero (0).

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

Property Value

long?

LastCompileBatchOffsetEnd

Information that can be provided to sys.dm_exec_sql_text along with last_compile_batch_sql_handle.
Note: Azure Synapse Analytics will always return zero (0).

[Column("last_compile_batch_offset_end")]
[Nullable]
public long? LastCompileBatchOffsetEnd { get; set; }

Property Value

long?

LastCompileBatchOffsetStart

Information that can be provided to sys.dm_exec_sql_text along with last_compile_batch_sql_handle.
Note: Azure Synapse Analytics will always return zero (0).

[Column("last_compile_batch_offset_start")]
[Nullable]
public long? LastCompileBatchOffsetStart { get; set; }

Property Value

long?

LastCompileBatchSqlHandle

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

Compilation statistics in microseconds.

[Column("last_compile_duration")]
[Nullable]
public long? LastCompileDuration { get; set; }

Property Value

long?

LastCompileMemoryKb

Compile memory statistics.
Note: Azure Synapse Analytics will always return zero (0).

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

Property Value

long?

LastCompileStartTime

Compile start time.

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

Property Value

DateTimeOffset?

LastExecutionTime

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

Optimization statistics.
Note: Azure Synapse Analytics will always return zero (0).

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

Property Value

long?

LastOptimizeDuration

Optimization statistics.

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

Property Value

long?

MaxCompileMemoryKb

Compile memory statistics.
Note: Azure Synapse Analytics will always return zero (0).

[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

ID of the database object that the query is part of (stored procedure, trigger, CLR UDF/UDAgg, etc.). 0 if the query is not executed as part of a database object (ad-hoc query).
Note: Azure Synapse Analytics will always return zero (0).

[Column("object_id")]
[Nullable]
public long? ObjectID { get; set; }

Property Value

long?

QueryHash

MD5 hash of the individual query, based on the logical query tree. Includes optimizer hints.

[Column("query_hash")]
[NotNull]
public byte[] QueryHash { get; set; }

Property Value

byte[]

QueryID

Primary key.

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

Property Value

long

QueryParameterizationType

Kind of parameterization:

0 - None

1 - User

2 - Simple

3 - Forced
Note: Azure Synapse Analytics will always return zero (0).

[Column("query_parameterization_type")]
[NotNull]
public byte QueryParameterizationType { get; set; }

Property Value

byte

QueryParameterizationTypeDesc

Textual description for the parameterization type.
Note: Azure Synapse Analytics will always return None.

[Column("query_parameterization_type_desc")]
[Nullable]
public string? QueryParameterizationTypeDesc { get; set; }

Property Value

string

QueryTextID

[Column("query_text_id")]
[NotNull]
public long QueryTextID { get; set; }

Property Value

long