Table of Contents

Class QueryStoreSchema.QueryStoreWaitStat

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

sys.query_store_wait_stats (Transact-SQL)

Applies to: √ SQL Server 2017 (14.x) and later √ Azure SQL Database

Contains information about the wait information for the query.


See sys.query_store_wait_stats.

[Table(Schema = "sys", Name = "query_store_wait_stats", IsView = true)]
public class QueryStoreSchema.QueryStoreWaitStat
Inheritance
QueryStoreSchema.QueryStoreWaitStat
Extension Methods

Properties

AvgQueryWaitTimeMs

Average wait duration for the query plan per execution within the aggregation interval and wait category (reported in milliseconds).

[Column("avg_query_wait_time_ms")]
[Nullable]
public double? AvgQueryWaitTimeMs { get; set; }

Property Value

double?

ExecutionType

Determines type of query execution:

0 - Regular execution (successfully finished)

3 - Client initiated aborted execution

4 - Exception aborted execution

[Column("execution_type")]
[NotNull]
public byte ExecutionType { get; set; }

Property Value

byte

ExecutionTypeDesc

Textual description of the execution type field:

0 - Regular

3 - Aborted

4 - Exception

[Column("execution_type_desc")]
[Nullable]
public string? ExecutionTypeDesc { get; set; }

Property Value

string

LastQueryWaitTimeMs

Last wait duration for the query plan within the aggregation interval and wait category (reported in milliseconds).

[Column("last_query_wait_time_ms")]
[NotNull]
public long LastQueryWaitTimeMs { get; set; }

Property Value

long

MaxQueryWaitTimeMs

Maximum CPU wait time for the query plan within the aggregation interval and wait category (reported in milliseconds).

[Column("max_query_wait_time_ms")]
[NotNull]
public long MaxQueryWaitTimeMs { get; set; }

Property Value

long

MinQueryWaitTimeMs

Minimum CPU wait time for the query plan within the aggregation interval and wait category (reported in milliseconds).

[Column("min_query_wait_time_ms")]
[NotNull]
public long MinQueryWaitTimeMs { get; set; }

Property Value

long

PlanID

Foreign key. Joins to sys.query_store_plan (Transact-SQL).

[Column("plan_id")]
[NotNull]
public long PlanID { get; set; }

Property Value

long

RuntimeStatsIntervalID

[Column("runtime_stats_interval_id")]
[NotNull]
public long RuntimeStatsIntervalID { get; set; }

Property Value

long

StdevQueryWaitTimeMs

Query wait duration standard deviation for the query plan within the aggregation interval and wait category (reported in milliseconds).

[Column("stdev_query_wait_time_ms")]
[Nullable]
public double? StdevQueryWaitTimeMs { get; set; }

Property Value

double?

TotalQueryWaitTimeMs

Total CPU wait time for the query plan within the aggregation interval and wait category (reported in milliseconds).

[Column("total_query_wait_time_ms")]
[NotNull]
public long TotalQueryWaitTimeMs { get; set; }

Property Value

long

WaitCategory

Wait types are categorized using the table below, and then wait time is aggregated across these wait categories. Different wait categories require a different follow-up analysis to resolve the issue, but wait types from the same category lead to similar troubleshooting experiences, and providing the affected query in addition to the waits is the missing piece to complete the majority of such investigations successfully.

[Column("wait_category")]
[NotNull]
public byte WaitCategory { get; set; }

Property Value

byte

WaitCategoryDesc

For textual description of the wait category field, review the table below.

[Column("wait_category_desc")]
[Nullable]
public string? WaitCategoryDesc { get; set; }

Property Value

string

WaitStatsID

Identifier of the row representing wait statistics for the plan_id, runtime_stats_interval_id, execution_type and wait_category. It is unique only for the past runtime statistics intervals. For the currently active interval, there may be multiple rows representing wait statistics for the plan referenced by plan_id, with the execution type represented by execution_type and the wait category represented by wait_category. Typically, one row represents wait statistics that are flushed to disk, while other(s) represent in-memory state. Hence, to get actual state for every interval you need to aggregate metrics, grouping by plan_id, runtime_stats_interval_id, execution_type and wait_category.

[Column("wait_stats_id")]
[NotNull]
public long WaitStatsID { get; set; }

Property Value

long