🗄️ SQL Server: Fix Query Store Forcing the Slower Cached Plan
Query Store’s plan forcing, whether applied automatically or via sp_query_store_force_plan, pins a specific execution plan to a query based on whatever plan looked best at the time it was forced, and that pin stays in effect regardless of how the underlying data distribution changes afterward. A forced plan chosen when a table was small can become the actively worse choice once the table grows, but Query Store has no mechanism to un-force a plan on its own; it keeps applying the pinned plan indefinitely, actively overriding whatever the optimizer would now choose if left alone, until someone manually intervenes.
🔎 The Problem
-- A plan was forced weeks ago when this query ran fastest -- with a nested loop join against a then-small table: EXEC sp_query_store_force_plan @query_id = 482, @plan_id = 917; -- Table has since grown 50x. The optimizer would now pick a -- hash join instead, but the forced plan overrides that choice -- on every execution - query duration has crept up for weeks -- with nothing in a normal plan review explaining why, since -- the forced plan still 'succeeds' without error
✅ Fix: Review Forced Plans Against Current Data
- Review sys.query_store_plan.is_forced_plan periodically against current table sizes and statistics, specifically for any plan forced more than a few weeks earlier, since a forced plan is a decision frozen in time, not a rule the optimizer keeps re-validating.
- Use
sp_query_store_unforce_planto release the pin before investigating a slow query that Query Store history shows was previously forced, rather than tuning indexes or rewriting the query against a plan that’s being artificially held in place. - Prefer Query Store’s automatic plan regression correction, where supported, over a permanent manual force when the goal is just to recover from a specific regression, since automatic correction can adapt again later while a manual force never will on its own.
🚨 Why This Is Dangerous
- A forced plan silently overriding the optimizer’s current best judgment means every subsequent tuning effort, new indexes, updated statistics, rewritten queries, can be completely ineffective, because the actual plan in use was never going to change no matter what else got tuned around it.
Forcing a plan freezes a decision in time — the data keeps moving, and Query Store will happily keep applying yesterday’s best answer to today’s very different table.



