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

See how SQLGrease can help fix your deadlocks

 

Subscribe to our mailing list

* indicates required

Follow @sqlgrease

Recent Posts

  • 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
  • Removing a table hint without changing code
  • Adding hints to queries with query store
  • Query store and plan guides for non parameterized SQL
  • Filtered indexes and the new parameter sniffing option (spoiler alert it doesn’t help)
  • Negative blocking session ids
  • Query store doesn’t work on read replicas
  • Improving performance of your RIGHT query
  • Improving performance of your LEFT query
  • Perform RTRIM and LTRIM in your code not in your queries
  • Performance of parameterized LIKE queries with new parameter sniffing option
  • Don’t use UPPER in WHERE unless you really need it
  • Estimate rows Vs Estimated rows to be read what’s the difference
  • Performance implications of using DATEDIFF function in WHERE
  • Performance implications of using ISNULL vs IS NULL
~