Skip to content

SQLGrease SQL Server Performance tips

Performance tuning tips from the SQLGrease team

  • Blog Home
  • About Me
  • Contact Me
  • SQLGrease Home Page

query store

Query store queries losing forced plans

December 2, 2023March 13, 2024 ~ franklinyamamoto

A common question I hear when discussing forcing of plans in query store is, “Why did a plan I previously forced quit using the forced plan?”.  In most cases this is related to having a database in an Always On Availability Group.  If the database IDs in the availability group differs across the servers, plan […]

Read More

Adding hints to queries with query store

November 26, 2023March 17, 2024 ~ franklinyamamoto

Up until recent, if you wanted to add a hint to a query without making code changes you had to use plan guides.  Plan guides can be tedious to create.  With SQL Server 2022, Azure SQL Database, or Azure Managed Instances you can now add hints to queries via Query Store. Using sp_query_store_set_hints The simplest […]

Read More

Query store doesn’t work on read replicas

May 5, 2022March 17, 2024 ~ franklinyamamoto

While attempting to find a query that ran on a read only replica, it got me wondering whether I needed to be querying the secondary, the primary, or the always on listener.  Turns out the answer is none of the above.  Query store only collects information from the primary.  If you query any of these […]

Read More

How to view query store id’s related to a sql/plan handle or query/plan hash.

February 15, 2020January 30, 2022 ~ franklinyamamoto ~ 2 Comments

On occasion you will have a sql_handle, plan_handle, query_hash, or query_plan_hash and need to know the query store ID related to it. One such example is with a deadlock.  Deadlocks contain sql_handles.  A key part of diagnosing deadlocks is viewing the execution plan.  Query store is a good place to view the execution plan and […]

Read More

Subscribe to our mailing list

* indicates required

Follow @sqlgrease

What are you waiting on?

Recent Posts

  • How CURSOR processing logic shows up in Query Store
  • Using GO in SSMS versus not – what is the difference
  • Unmatched Indexes plan warnings
  • No Join Predicate plan warning may be a red herring
  • Parallel plans can be selected with scalar UDF’s
  • What’s my parallel query waiting on?
  • Improving performance of SUBSTRING queries
  • Execution plan shortcuts causing random long executions
  • SQL Server compile locks
  • Are you searching for a Precise I3 replacement?
  • How to measure query runtime when developing/testing – part 3
  • Deadlock graphs now contain query hashes
  • RESOURCE_SEMAPHORE waits caused by OBJECTSTORE_LOCK_MANAGER memory usage
  • Opening an actual plan in a separate SSMS tab
  • How to measure query runtime when developing/testing – part 2
  • How to measure query runtime when developing/testing – part 1
  • OLEDB waits: what they mean and a few ideas on addressing them
  • STATMAN queries causing you timeouts?
  • What does the status column of a session mean in SQL Server?
  • Query store queries losing forced plans
~