Query Store Enhancements in SQL Server 2022

Hi friends, in this article, we’ll be discussing about Query Store Enhancements in SQL Server 2022. Note that this lecture, is part of my online course on Udemy, titled: “SQL Server 2022: What’s New – New and Enhanced Features“.


About Query Store in SQL Server

Query Store, is feature that was originally shipped with SQL Server 2016.

Its primary purpose, is to collect usage and performance data for various SQL Server objects, such as: queries, plans, runtime statistics, etc.

You can then use this data, for easily identifying performance bottlenecks and conduct performance-related troubleshooting.

Note that up to SQL Server 2019, Query Store was turned off by default for new databases.,


Query Store in SQL Server 2022 and Query Store Hints

In SQL Server 2022, Query Store functionality has been extended to also support secondary replicas just like it supports primary replicas.

Moreover, Query Store, it is now enabled by default for every new database that is created in SQL Server 2022.

In addition to the above, you can now use Query Store hints.

The main characteristics of these hints are:

  • You can shape query execution plans without changing application code
  • Can be used via the OPTION clause
  • Requires that Query Store is enabled

Based on all the above, we can see that Query Store hints, allow the Database Administrator and Developer, to tune the application’s database performance directly on the database-level, without having the application’s code. This is a significant new enhancement in SQL Server 2022.


Procedure for Using Query Store Hints in SQL Server 2022

The procedure for using Query Store Hints in SQL Server is quite simple and consists of two steps:

  • Step 1: Identify the query_id in Query Store for which you want to set the hint
  • Step 2: Execute the sys.sp_query_store_set_hints system stored procedure, along with specifying the query id and hint name


Learn More – Watch our Video on YouTube!

Subscribe to my YouTube Channel!


Learn More About What’s New in SQL Server 2022 – Enroll to the Course!

Feel free to check our course on Udemy, titled “SQL Server 2022: What’s New – New and Enhanced Features“.

Via the course, you will learn all about the new features and enhancements in SQL Server 2022, via a rich set of high-quality lectures, infographics and step-by-step live demonstrations.

SQL Server 2022: What's New - New and Enhanced Features (Online Course)
(Lifetime access, live demos, downloadable resources, quizzes)

Learn More on Udemy



Watch the course preview:


Featured Online Courses:


Read Also:


Subscribe to our newsletter and stay up to date!

Subscribe to our YouTube channel (SQLNetHub TV)

Check our eBooks!


Rate this article: 1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)


Reference: SQLNetHub.com (https://www.sqlnethub.com)

© SQLNetHub