Blog Post

Azure SQL Blog
4 MIN READ

AI-assisted Query Performance Tuning comes to SSMS GitHub Copilot Agent mode (in Preview)

MadhumitaTripathyMSFT's avatar
Nov 25, 2026

Hi there, and thanks for stopping by. 

Let me start with a question. When was the last time a single query ruined your afternoon? 

Maybe it was a high-CPU alert that popped up right after a release. Maybe a report that used to come back in two seconds suddenly took two minutes, or maybe you were simply staring at an execution plan, scrolling left and right across a sea of operators, trying to figure out which one was the real villain. 

If any of that sounds familiar, this post is for you. Let me tell you about something our team has been working on for a while, and why I'm genuinely excited that you can now try it yourself. 

So, what is it? 

GitHub Copilot in SSMS 22.12.1 Release Notes onwards can now help you understand why a query is slow or resource-intensive, and how to improve it. In Agent mode, Copilot uses query performance tuning skills to analyze your query and its execution plan, help identify likely root cause, and recommend potential fixes ordered by expected impact. 

Here are few things you can ask it to do:

  • Help improve this query
  • Suggest a rewritten version of a query that's expected to run faster
  • Recommend any missing index that can help improve the query execution time
  • Recommend query hints, and explain the trade-offs

What a conversation actually looks like

Let me walk you through how this feels in practice, and the experience that you see while this improvement is in Preview.

You open a query editor in SSMS. Connect to a dev or test copy of the database where you want to analyze the query and paste the slow or high CPU query in the query editor. You open Copilot Chat in SSMS and switch to Agent mode, pick a model, and simply ask:

  • Why is this query slow? or can you improve this query?

By default, the agent starts with a quick triage and gives you a first answer: the most likely cause and potential recommendations. If that's enough, great. If you want to go deeper, just keep talking to it:

  • Rewrite this query to make it run faster.
  • Is there an index that would further improve the rewritten query?
  • Do the plan analysis and identify the cause of slowness.

For plan analysis, you can open the estimated or actual execution plan in the query editor in SSMS and ask the agent to analyze it.

 

  • Do a full analysis of this query and its execution plan.

A full analysis comes back as a report you can actually read: baseline metrics from the plan, the root cause (an anti-pattern, an implicit conversion blocking an index seek, a bad cardinality estimate and so on), ordered recommendations with their reasoning and estimated improvement.

You stay in control. Always.

I want to be very clear about this part, because trust matters more than speed.

Copilot recommends changes, but it doesn't apply them to your database. By default, it analyzes the estimated execution plan and doesn't run the user query. If a step needs to run something, for example to collect actual runtime statistics or actual execution plan, the agent asks for your permission first.

When you get a potential recommendation, you like: review the reasoning, copy the script into a query editor, test it in a dev or test database with representative data, compare duration, CPU time and logical reads, and then roll it out through your normal change management process.

And please, always review scripts before you run them. AI can make mistakes, and you know your system better than any model does.

Let's get you started

Refer Query performance tuning in SSMS GitHub Copilot Agent mode for detailed instructions.

Here's what you need at a high-level:

  1. SSMS 22.12.1 or later Release Notes for SQL Server Management Studio (SSMS) | Microsoft Learn , with the AI Assistance workload installed
  2. A GitHub account with Copilot Agent mode access
  3. Preview features turned on for the SQL tools MCP server: go to Tools > Options > Preview Features and select Turn on Preview Features for SQL tools MCP server
  4. Restart the sql-tools MCP server from the tools list in Copilot Chat (or just close and reopen SSMS)
  5. Type #improve-query-performance in the chat to confirm the skill is loaded and if the skill is visible you are ready to test this functionality

A few tips from our preview participants that I'd pass on to you:

  • Connect to the database where the problem is potentially reproducible or, so Copilot has the right context
  • Include the full query text and describe the symptom: high CPU, long duration etc.
  • Start with a quick analysis, then go deeper when you need to
  • Test this functionality outside your production environment during the Preview phase.

What it doesn't do

In preview, the agent analyzes one query at a time, not a batch or whole workload. Estimated improvements can differ from actual results. By default, the agent analyzes the estimated execution plan, so it doesn't need to execute the user query. For more accurate results, you can prompt it to use the actual execution plan instead. Because this requires running the actual query, the agent asks for your permission first. New indexes cost storage and can slow down writes, so weigh that before creating them.

Tell us what you think and how you want us to improve it

We'd love to hear from you. Try it on a query that has been troubling you. Then tell us how it went. Use the thumbs-up and thumbs-down buttons in the chat, report a problem or submit new ideas here Developer Community for SQL Server Management Studio.

Learn more

 

Published Nov 25, 2026
Version 1.0