sql server – Query Store Plan Forcing is Failing with OPTIMIZATION_REPLAY_FAILED

I am trying to use Query Store to force a particular plan in an Azure SQL DB database, and it’s not obeying me! I’ve checked in sys.query_store_plan, and it has a column which describes the reason for the failure. Some of these are pretty straightforward to understand (e.g. “NO_INDEX: Index specified in plan no longer exists”). However, the error message that I get is OPTIMIZATION_REPLAY_FAILED, which is described in the documentation as “The optimization replay script failed to execute.”

I would like to figure out why the optimization replay script failed to execute, but I can’t find anything out there that really says anything more detailed that what I’ve wrote above. How I can figure out what is stopping my plan from being forced?

Read more here: Source link