Question 1
A financial services company is using an Azure SQL Managed Instance, which is part of a failover group spanning two Azure regions for disaster recovery. During a DR test, a planned failover is initiated. After the failover, applications report intermittent, long-running queries that were previously fast. Analysis shows that the issue is due to parameter-sensitive plans (PSP) that were optimal in the primary region but are inefficient with the data distribution on the now-primary secondary replica. Which action should be taken to resolve this performance issue with minimal service disruption?
Answer and explanation
Correct answer: D
The correct answer is to use sp_query_store_clear_message_queues. When a failover occurs in a geo-replication or failover group setup, the Query Store data is replicated to the secondary. However, performance statistics (runtime stats) are not, leading to a potential mismatch. Running this procedure on the secondary just before a planned failover clears any queued-up, in-flight statistics, preventing the carry-over of potentially misleading performance data from the primary. This allows the new primary to generate fresh, relevant statistics post-failover, mitigating issues like PSP optimization problems. Failing back is disruptive. Automatic Tuning might eventually fix it but is not the immediate, targeted solution. Clearing the entire Query Store is a drastic measure that loses all historical performance data.