Last week, Microsoft's AI chief, Mustafa Suleyman, told Fortune that 'Most tasks that involve "sitting down at a computer" will be fully automated by AI within the next year or 18 months'. He also said "It is going to be possible to design an AI that suits your requirements for every institution, organization, and person on the planet."
I read that on Friday. Yesterday I installed the latest First Responder Kit on my SQL Server 2025 instance, and I spent today trying to get sp_BlitzCache to talk to ChatGPT.
What Brent Shipped
The newest First Responder Kit (version 8.29) added AI integration to sp_BlitzCache. The procedure that has been helping DBAs find expensive queries for over a decade can now send those queries to an AI model and get tuning advice back — all from inside the engine, using sp_invoke_external_rest_endpoint. Here I am only testing with the top 1 query plan to keep things light:
-- this one calls ChatGPT (or Gemini) for you with the query plan in question -- scroll to 'AI Advice' to see how ChatGPT assesed your query plan EXEC sp_BlitzCache @Top = 1, @AI = 1 -- this one only generates the call prompt for you -- scroll to 'AI Prompt' to see what you can ask your AI about the pain points EXEC sp_BlitzCache @Top = 1, @AI = 2
In short, when @AI = 1, sp_BlitzCache loops through every expensive query it finds and builds an AI prompt for each one. Just like before, sp_BlitzCache outputs the query text, the execution plan XML, and a full set of performance metrics: CPU, duration, reads, writes, memory grants, spills, execution count, and any warnings the procedure already detected. What's new is that all of this gets packed into a JSON payload and sent to the AI endpoint via sp_invoke_external_rest_endpoint, where the AI's response comes back to you in the ai_advice column in the result set. No more cut/paste/edit/askChatGPT. The sp_BlitzCache call is doing the legwork for you.
When @AI = 2, the same expensive query work is done, but it only generates the prompt without calling the AI. This lets you review what would be sent first, or you can even paste it into another AI tool.
Very thoughtful, practical engineering -- regardless of where you stand with AI.
The Setup
Brent's full walkthrough covers this in detail. Here is the short version of what I had to do:
-- Enable outbound REST calls (disabled by default):
EXEC sp_configure 'external rest endpoint enabled', 1;
RECONFIGURE WITH OVERRIDE;
GO
-- Credentials must live in a user database, not master.
-- The credential name must be the provider's root URL exactly.
USE DBA;
GO
CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'SomeStrongPassword!123';
GO
CREATE DATABASE SCOPED CREDENTIAL [https://api.openai.com/]
WITH IDENTITY = 'HTTPEndpointHeaders',
SECRET = '{"Authorization":"Bearer YourChatGPTAPIKeyGoesHere"}';
GO
One note on that credential: the CREATE ran without error, but my first sp_BlitzCache @AI = 1 call came back instantly - also without error - but this was in the ai_advice column:
API Error: Incorrect API key provided: sk-proj-***...***8pgA. You can find your API key at https://platform.openai.com/account/api-keys.
The SECRET value needs to be exactly {"Authorization":"Bearer <key>"} — there is a space after 'Bearer' and no extra whitespace around the key itself. Once I recreated the credential with the correct API Key string, the sp_BlitzCache @AI = 1 call took more time to complete and provided this insight in the AI Advice column:
About That Prediction
Mr. Suleyman said it will be possible to design an AI for every institution, organization and person on the planet. But every call sp_BlitzCache makes to the AI is stateless — a fresh conversation with no memory of anything before it. That is not a blitzCache flaw. That is AI. The model cannot know the query ran poorly last Tuesday, that you added an index on Wednesday, or that the column it wants you to index is on its way out. It can get the plan and the metrics - which is great! - but there is no way it can access that knowledge the DBA has to support it.
A DBA carries years of context that no prompt can contain — why the schema is what it is, which index exists because of an outage 3 years ago, or which stored procedure cannot be rewritten for political reasons. AI sees the query. The DBA knows the story.
What I Actually Think
Brent built something genuinely useful here. sp_BlitzCache calling ChatGPT gave me tuning suggestions I would have arrived at eventually — but much faster, and with a couple of angles I hadn't even considered. That is real value.
But getting there required configuration, credentials, network paths, security review, and a clear understanding of what the AI can and cannot see. That work is not going away. If anything, features like this create more of it — and it is work that requires a human who knows the environment.
The robots are not taking the job. They are adding to it.
Next up, I want to test the custom system prompts Brent outlined — code review, index-only tuning, blocking analysis. If you've already set this up in your environment, I'd like to hear what you found. Please let me know.
More to Read:
Brent Ozar: Get ChatGPT's Advice On Your Queries with sp_BlitzCache
Microsoft Learn: sp_invoke_external_rest_endpoint (Transact-SQL)
Fortune: Microsoft AI chief gives it 18 months — for all white-collar work to be automated by AI
