|
2 | 2 | title: "Best practices with Query Store" |
3 | 3 | 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. |
4 | 4 | ms.custom: "" |
5 | | -ms.date: "1/29/2021" |
| 5 | +ms.date: "6/09/2021" |
6 | 6 | ms.prod: sql |
7 | 7 | ms.prod_service: "database-engine, sql-database" |
8 | 8 | ms.technology: performance |
@@ -332,7 +332,7 @@ FROM sys.database_query_store_options; |
332 | 332 |
|
333 | 333 | If the problem persists, it indicates that corruption of Query Store data is persisted on the disk. |
334 | 334 |
|
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. |
336 | 336 |
|
337 | 337 | If the recovery was unsuccessful, you can try clearing Query Store before you set the read-write mode. |
338 | 338 |
|
@@ -385,12 +385,12 @@ Also, Query Store can rapidly exceed the size quota because of a potentially lar |
385 | 385 |
|
386 | 386 | Consider the following options: |
387 | 387 |
|
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). |
389 | 389 | - 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. |
391 | 391 | - 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. |
392 | 392 | - 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. |
394 | 394 | - Set QUERY_CAPTURE_MODE to AUTO to automatically filter out ad-hoc queries with small resource consumption. |
395 | 395 |
|
396 | 396 | ## <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 |
452 | 452 |
|
453 | 453 | ## See also |
454 | 454 |
|
455 | | -- [ALTER DATABASE SET options (Transact-SQL)](../../t-sql/statements/alter-database-transact-sql-set-options.md) |
456 | | -- [Query Store catalog views (Transact-SQL)](../../relational-databases/system-catalog-views/query-store-catalog-views-transact-sql.md) |
457 | | -- [Query Store stored procedures (Transact-SQL)](../../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 (Transact-SQL)](../../t-sql/statements/alter-database-transact-sql-set-options.md) |
| 456 | + - [Query Store catalog views (Transact-SQL)](../../relational-databases/system-catalog-views/query-store-catalog-views-transact-sql.md) |
| 457 | + - [Query Store stored procedures (Transact-SQL)](../../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) |
0 commit comments