QuestionQ38

VerifiedSecure, optimize, and deploy database solutions

You have an Azure SQL database that supports a customer-facing API. The API invokes a stored procedure named dbo.GetCustomerOrders thousands of times each hour.

Following a deployment that updated indexes and statistics, users report that the API endpoint supported by dbo.GetCustomerOrders is slower. In Query Store, the same query now has two persisted execution plans. Over the past hour, the newer plan has had a substantially higher average duration and CPU time than the older plan.

You need to restore the earlier performance quickly without modifying the API code.

Which Transact-SQL command should you run?

Explanation

sp_query_store_force_plan forces a specified persisted Query Store plan for a query, allowing the known lower-duration, lower-CPU plan to be used again without changing application code. It is supported in Azure SQL Database.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!