Skip to content

Commit a4e7a0e

Browse files
20210514 1424
1 parent 46996bb commit a4e7a0e

7 files changed

Lines changed: 63 additions & 65 deletions

docs/relational-databases/performance/best-practice-with-the-query-store.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Best practices with Query Store"
33
description: Learn best practices for using SQL Server Query Store with your workload, such as using the latest SQL Server Management Studio and Query Performance Insight.
44
ms.custom: ""
5-
ms.date: "1/29/2021"
5+
ms.date: "6/09/2021"
66
ms.prod: sql
77
ms.prod_service: "database-engine, sql-database"
88
ms.technology: performance
@@ -332,7 +332,7 @@ FROM sys.database_query_store_options;
332332

333333
If the problem persists, it indicates that corruption of Query Store data is persisted on the disk.
334334

335-
Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)], Query Store can be recovered by executing the **sp_query_store_consistency_check** stored procedure within the affected database. Query Store must be disabled before you attempt the recovery operation. For [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)], you need to clear the data from Query Store as shown.
335+
Starting with [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)], Query Store can be recovered by executing the `sys.sp_query_store_consistency_check` stored procedure within the affected database. Query Store must be disabled before you attempt the recovery operation. For [!INCLUDE[sssql16-md](../../includes/sssql16-md.md)], you need to clear the data from Query Store as shown.
336336

337337
If the recovery was unsuccessful, you can try clearing Query Store before you set the read-write mode.
338338

@@ -385,12 +385,12 @@ Also, Query Store can rapidly exceed the size quota because of a potentially lar
385385

386386
Consider the following options:
387387

388-
- Parameterize queries where applicable. For example, wrap queries inside a stored procedure or sp_executesql. For more information, see [Parameters and execution plan reuse](../../relational-databases/query-processing-architecture-guide.md#PlanReuse).
388+
- Parameterize queries where applicable. For example, wrap queries inside a stored procedure or `sp_executesql`. For more information, see [Parameters and execution plan reuse](../../relational-databases/query-processing-architecture-guide.md#PlanReuse).
389389
- Use the [optimize for ad hoc workloads](../../database-engine/configure-windows/optimize-for-ad-hoc-workloads-server-configuration-option.md) option if your workload contains many single-use ad-hoc batches with different query plans.
390-
- Compare the number of distinct query_hash values with the total number of entries in sys.query_store_query. If the ratio is close to 1, your ad-hoc workload generates different queries.
390+
- Compare the number of distinct query_hash values with the total number of entries in `sys.query_store_query`. If the ratio is close to 1, your ad-hoc workload generates different queries.
391391
- Apply [forced parameterization](../../relational-databases/query-processing-architecture-guide.md#ForcedParam) for the database or for a subset of queries if the number of different query plans isn't large.
392392
- Use a [plan guide](../../relational-databases/performance/specify-query-parameterization-behavior-by-using-plan-guides.md) to force parameterization only for the selected query.
393-
- Configure forced parameterization by using the [parameterization database option](../../relational-databases/databases/database-properties-options-page.md#miscellaneous) command, if there are a small number of different query plans in your workload. An example is when the ratio between the count of distinct query_hash and the total number of entries in sys.query_store_query is much less than 1.
393+
- Configure forced parameterization by using the [parameterization database option](../../relational-databases/databases/database-properties-options-page.md#miscellaneous) command, if there are a small number of different query plans in your workload. An example is when the ratio between the count of distinct query_hash and the total number of entries in `sys.query_store_query` is much less than 1.
394394
- Set QUERY_CAPTURE_MODE to AUTO to automatically filter out ad-hoc queries with small resource consumption.
395395

396396
## <a name="Drop"></a> Avoid a DROP and CREATE pattern for containing objects
@@ -452,10 +452,10 @@ For more on estimating and configuring the size of the secondary Azure SQL datab
452452

453453
## See also
454454

455-
- [ALTER DATABASE SET options &#40;Transact-SQL&#41;](../../t-sql/statements/alter-database-transact-sql-set-options.md)
456-
- [Query Store catalog views &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/query-store-catalog-views-transact-sql.md)
457-
- [Query Store stored procedures &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/query-store-stored-procedures-transact-sql.md)
458-
- [Use Query Store with In-Memory OLTP](../../relational-databases/performance/using-the-query-store-with-in-memory-oltp.md)
459-
- [Monitor performance by using Query Store](../../relational-databases/performance/monitoring-performance-by-using-the-query-store.md)
460-
- [Query processing architecture guide](../../relational-databases/query-processing-architecture-guide.md)
461-
- [Query Store hints (Preview)](query-store-hints.md)
455+
- [ALTER DATABASE SET options &#40;Transact-SQL&#41;](../../t-sql/statements/alter-database-transact-sql-set-options.md)
456+
- [Query Store catalog views &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/query-store-catalog-views-transact-sql.md)
457+
- [Query Store stored procedures &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/query-store-stored-procedures-transact-sql.md)
458+
- [Use Query Store with In-Memory OLTP](../../relational-databases/performance/using-the-query-store-with-in-memory-oltp.md)
459+
- [Monitor performance by using Query Store](../../relational-databases/performance/monitoring-performance-by-using-the-query-store.md)
460+
- [Query processing architecture guide](../../relational-databases/query-processing-architecture-guide.md)
461+
- [Query Store Hints](query-store-hints.md)

docs/relational-databases/performance/cardinality-estimation-sql-server.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: "Cardinality Estimation (SQL Server)"
33
description: The SQL Server Query Optimizer selects query plans that have the lowest estimated processing cost, which it determines based on rows processed and a cost model.
44
ms.custom: ""
5-
ms.date: "02/11/2021"
5+
ms.date: "06/09/2021"
66
ms.prod: sql
77
ms.prod_service: "database-engine, sql-database"
88
ms.reviewer: ""
@@ -21,7 +21,8 @@ monikerRange: "=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||
2121

2222
# Cardinality Estimation (SQL Server)
2323

24-
[!INCLUDE [SQL Server Azure SQL Database](../../includes/applies-to-version/sql-asdb.md)]
24+
[!INCLUDE [SQL Server Azure SQL Database Azure SQL Managed Instance](../../includes/applies-to-version/sql-asdb-asdbmi.md)]
25+
2526

2627
The [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] Query Optimizer is a cost-based Query Optimizer. This means that it selects query plans that have the lowest estimated processing cost to execute. The Query Optimizer determines the cost of executing a query plan based on two main factors:
2728

@@ -271,7 +272,7 @@ EXEC sys.sp_query_store_set_hints @query_id= 39, @query_hints = N'OPTION(USE HIN
271272

272273
The Query Store gives you different ways that you can force the system to use a particular query plan:
273274

274-
- Execute **sp_query_store_force_plan**.
275+
- Execute `sys.sp_query_store_force_plan`.
275276

276277
- In [!INCLUDE[ssManStudio](../../includes/ssManStudio-md.md)], expand your **Query Store** node, right-click **Top Resource Consuming Nodes**, and then click **View Top Resource Consuming Nodes**. The display shows buttons labeled **Force Plan** and **Unforce Plan**.
277278

@@ -316,11 +317,12 @@ WHERE s.ticket = r.ticket AND
316317
r.date = '2016-05-11';
317318
```
318319

319-
## See Also
320-
[Monitor and Tune for Performance](../../relational-databases/performance/monitor-and-tune-for-performance.md)
321-
[Optimizing Your Query Plans with the SQL Server 2014 Cardinality Estimator](/previous-versions/dn673537(v=msdn.10))
322-
[Query Hints](../../t-sql/queries/hints-transact-sql-query.md)
323-
[USE HINT Query Hints](../../t-sql/queries/hints-transact-sql-query.md#use_hint)
324-
[Upgrading Databases by using the Query Tuning Assistant](../../relational-databases/performance/upgrade-dbcompat-using-qta.md)
325-
[Monitoring Performance By Using the Query Store](../../relational-databases/performance/monitoring-performance-by-using-the-query-store.md)
326-
[Query Processing Architecture Guide](../../relational-databases/query-processing-architecture-guide.md)
320+
## See also
321+
- [Monitor and Tune for Performance](../../relational-databases/performance/monitor-and-tune-for-performance.md)
322+
- [Optimizing Your Query Plans with the SQL Server 2014 Cardinality Estimator](/previous-versions/dn673537(v=msdn.10))
323+
- [Query Hints](../../t-sql/queries/hints-transact-sql-query.md)
324+
- [USE HINT Query Hints](../../t-sql/queries/hints-transact-sql-query.md#use_hint)
325+
- [Upgrading Databases by using the Query Tuning Assistant](../../relational-databases/performance/upgrade-dbcompat-using-qta.md)
326+
- [Monitoring Performance By Using the Query Store](../../relational-databases/performance/monitoring-performance-by-using-the-query-store.md)
327+
- [Query Processing Architecture Guide](../../relational-databases/query-processing-architecture-guide.md)
328+
- [Query Store Hints](query-store-hints.md)

docs/relational-databases/system-catalog-views/query-store-catalog-views-transact-sql.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "Query Store Catalog Views (Transact-SQL)"
33
title: "Query Store Catalog Views (Transact-SQL)"
44
ms.custom: ""
5-
ms.date: "01/25/2021"
5+
ms.date: "06/09/2021"
66
ms.prod: sql
77
ms.prod_service: "database-engine, sql-database"
88
ms.reviewer: ""
@@ -22,7 +22,7 @@ monikerRange: "=azuresqldb-current||>=sql-server-2016||= azure-sqldw-latest||>=s
2222

2323
This section contains the following catalog views.
2424

25-
## In this Section
25+
## In this section
2626

2727
- [sys.database_query_store_options &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/sys-database-query-store-options-transact-sql.md)
2828

@@ -42,8 +42,7 @@ monikerRange: "=azuresqldb-current||>=sql-server-2016||= azure-sqldw-latest||>=s
4242
-
4343
- [sys.query_store_query_hints &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/sys-query-store-query-hints-transact-sql.md)
4444

45-
## See Also
46-
[Query Store Stored Procedures &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/query-store-stored-procedures-transact-sql.md)
47-
[Monitoring Performance By Using the Query Store](../../relational-databases/performance/monitoring-performance-by-using-the-query-store.md)
48-
49-
45+
## See also
46+
47+
- [Query Store Stored Procedures &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/query-store-stored-procedures-transact-sql.md)
48+
- [Monitoring Performance By Using the Query Store](../../relational-databases/performance/monitoring-performance-by-using-the-query-store.md)

docs/relational-databases/system-stored-procedures/query-store-stored-procedures-transact-sql.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "Query Store Stored Procedures (Transact-SQL)"
33
title: "Query Store Stored Procedures (Transact-SQL) | Microsoft Docs"
44
ms.custom: ""
5-
ms.date: "03/29/2016"
5+
ms.date: "06/09/2021"
66
ms.prod: sql
77
ms.prod_service: "database-engine, sql-database"
88
ms.reviewer: ""
@@ -14,7 +14,6 @@ helpviewer_keywords:
1414
- "system stored procedures [SQL Server], query store"
1515
- "stored procedures [SQL Server], query store"
1616
- "query store [SQL Server], stored procedures"
17-
ms.assetid: 9bddbb74-e67a-43e3-b89e-896c498e53cb
1817
author: markingmyname
1918
ms.author: maghan
2019
monikerRange: "=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current"
@@ -25,7 +24,7 @@ monikerRange: "=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||
2524

2625
This section contains the following stored procedures used to configure the query store.
2726

28-
## In this Section
27+
## In this section
2928

3029
- [sp_query_store_flush_db &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/sp-query-store-flush-db-transact-sql.md)
3130

@@ -41,8 +40,6 @@ monikerRange: "=azuresqldb-current||>=sql-server-2016||>=sql-server-linux-2017||
4140

4241
- [sp_query_store_set_hints (Transact-SQL)](../../relational-databases/system-stored-procedures/sys-sp-query-store-set-hints-transact-sql.md)
4342

44-
## See Also
45-
[Query Store Catalog Views &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/query-store-catalog-views-transact-sql.md)
46-
[Monitoring Performance By Using the Query Store](../../relational-databases/performance/monitoring-performance-by-using-the-query-store.md)
47-
48-
43+
## See also
44+
- [Query Store Catalog Views &#40;Transact-SQL&#41;](../../relational-databases/system-catalog-views/query-store-catalog-views-transact-sql.md)
45+
- [Monitoring Performance By Using the Query Store](../../relational-databases/performance/monitoring-performance-by-using-the-query-store.md)

docs/relational-databases/system-stored-procedures/sys-sp-query-store-clear-hints-transact-sql.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ FROM sys.query_store_query_hints
6565
WHERE query_id = 39;
6666
```
6767

68-
## See Also
68+
## See also
6969
- [sys.sp_query_store_set_hints (Transact-SQL)](sys-sp-query-store-set-hints-transact-sql.md)
7070
- [sys.query_store_query_hints (Transact-SQL)](../system-catalog-views/sys-query-store-query-hints-transact-sql.md)
7171
- [Query Store hints](../performance/query-store-hints.md).

docs/t-sql/queries/hints-transact-sql-query.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description: "Hints (Transact-SQL) - Query"
33
title: "Query Hints (Transact-SQL)"
44
ms.custom: ""
5-
ms.date: "01/26/2021"
5+
ms.date: "06/09/2021"
66
ms.prod: sql
77
ms.prod_service: "database-engine, sql-database"
88
ms.technology: t-sql
@@ -204,7 +204,7 @@ Forces the Query Optimizer to relax the estimated recompile threshold for a quer
204204
Specifying KEEP PLAN makes sure a query won't be recompiled as frequently when there are multiple updates to a table.
205205

206206
KEEPFIXED PLAN
207-
Forces the Query Optimizer not to recompile a query because of changes in statistics. Specifying KEEPFIXED PLAN makes sure that a query recompiles only if the schema of the underlying tables changes or if **sp_recompile** runs against those tables.
207+
Forces the Query Optimizer not to recompile a query because of changes in statistics. Specifying KEEPFIXED PLAN makes sure that a query recompiles only if the schema of the underlying tables changes or if `sp_recompile` runs against those tables.
208208

209209
IGNORE_NONCLUSTERED_COLUMNSTORE_INDEX
210210
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] (starting with [!INCLUDE[ssSQL11](../../includes/sssql11-md.md)]).
@@ -224,7 +224,7 @@ The minimum memory grant size in PERCENT of configured memory limit. The query i
224224
MAXDOP <integer_value>
225225
**Applies to**: [!INCLUDE[ssNoVersion](../../includes/ssnoversion-md.md)] (starting with [!INCLUDE[ssKatmai](../../includes/sskatmai-md.md)]) and [!INCLUDE[ssSDSfull](../../includes/sssdsfull-md.md)].
226226

227-
Overrides the **max degree of parallelism** configuration option of **sp_configure**. Also overrides the Resource Governor for the query specifying this option. The MAXDOP query hint can exceed the value configured with sp_configure. If MAXDOP exceeds the value configured with Resource Governor, the [!INCLUDE[ssDE](../../includes/ssde-md.md)] uses the Resource Governor MAXDOP value, described in [ALTER WORKLOAD GROUP &#40;Transact-SQL&#41;](../../t-sql/statements/alter-workload-group-transact-sql.md). All semantic rules used with the **max degree of parallelism** configuration option are applicable when you use the MAXDOP query hint. For more information, see [Configure the max degree of parallelism Server Configuration Option](../../database-engine/configure-windows/configure-the-max-degree-of-parallelism-server-configuration-option.md).
227+
Overrides the **max degree of parallelism** configuration option of `sp_configure`. Also overrides the Resource Governor for the query specifying this option. The MAXDOP query hint can exceed the value configured with `sp_configure`. If MAXDOP exceeds the value configured with Resource Governor, the [!INCLUDE[ssDE](../../includes/ssde-md.md)] uses the Resource Governor MAXDOP value, described in [ALTER WORKLOAD GROUP &#40;Transact-SQL&#41;](../../t-sql/statements/alter-workload-group-transact-sql.md). All semantic rules used with the **max degree of parallelism** configuration option are applicable when you use the MAXDOP query hint. For more information, see [Configure the max degree of parallelism Server Configuration Option](../../database-engine/configure-windows/configure-the-max-degree-of-parallelism-server-configuration-option.md).
228228

229229
> [!WARNING]
230230
> If MAXDOP is set to zero, then the server chooses the max degree of parallelism.
@@ -686,13 +686,11 @@ EXEC sys.sp_query_store_set_hints @query_id= 39, @query_hints = N'OPTION(MAX_GRA
686686
EXEC sys.sp_query_store_set_hints @query_id= 39, @query_hints = N'OPTION(RECOMPILE, MAXDOP 1, USE HINT(''QUERY_OPTIMIZER_COMPATIBILITY_LEVEL_110''))';
687687
```
688688

689+
## See also
689690

690-
691-
692-
## See Also
693-
[Hints &#40;Transact-SQL&#41;](../../t-sql/queries/hints-transact-sql.md)
694-
[sp_create_plan_guide &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/sp-create-plan-guide-transact-sql.md)
695-
[sp_control_plan_guide &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/sp-control-plan-guide-transact-sql.md)
696-
[Trace Flags](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md)
697-
[Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
698-
[Query Store hints](../../relational-databases/performance/query-store-hints.md)
691+
- [Hints &#40;Transact-SQL&#41;](../../t-sql/queries/hints-transact-sql.md)
692+
- [sp_create_plan_guide &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/sp-create-plan-guide-transact-sql.md)
693+
- [sp_control_plan_guide &#40;Transact-SQL&#41;](../../relational-databases/system-stored-procedures/sp-control-plan-guide-transact-sql.md)
694+
- [Trace Flags](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md)
695+
- [Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
696+
- [Query Store hints](../../relational-databases/performance/query-store-hints.md)

0 commit comments

Comments
 (0)