New Claude Plugin For SQL Server Query Plan Analysis
Chapters
- 00:00:00 – Introduction
- 00:00:29 – New Cloud Marketplace Skill
- 00:01:39 – Cloud Agent Analysis
- 00:03:13 – Query Plan Analysis Results
- 00:05:30 – Try the New Cloud Plugin
Full Transcript
Erik Darling here with Darling Data, continuing my fast ascendancy to monitoring tool mogulhood. What you see in the background is the latest iteration in advance in my free open source SQL Server monitoring tool. This is going to be the enterprise edition of it, but we’ll talk more about that later.
What I want to talk about in this video is a new Cloud Marketplace skill that you can see chugging away here in the background. And what it aims to do is take the analysis engine from my performance studio application, which includes plan parsing and analysis rules and all sorts of other stuff, and hand them over to an agent.
So you can use Cloud, of course, but there are poor unfortunate souls in the world who are forced to labor under the drudgery of GitHub Copilot. And I feel bad for them because Copilot is just plum embarrassing. I would smack the words out of its mouth if it were a human.
It is… There aren’t words for it. It’s dumb. But a friend of the repo, Hannah Vernon, was nice enough to open a pull request to give our imbecilic Copilot LLM access to this as well.
So hopefully you will gain some respite from its moronics. But back to the tool at hand. We have a Cloud agent here looking at a query plan that I gave it.
You can see up at the top it said, Hello, Cloud, can you tell me why this query plan is so gosh darn slow? And the Cloud pulled up the skill that I gave it.
Up here, let me look. Successfully loaded this skill. And now Cloud is chugging away. Analyzing the query plan with my analysis engine.
And you can see it using all that. And the reason why I did this is because I got so tired of re-explaining execution plan minutiae either to a new Cloud agent locally or abroad. You have to say like, no, I don’t want to hear about logical reads.
No, I don’t care about operator costs. No, Cloud, row mode operator times are cumulative. Batch mode operator times are cumulative. Batch mode operator times are insular.
No, that’s not what that wait step means. No, buddy, what are you doing? So I got very tired of having to do that over and over again and basically have to retrain every Cloud that I talked to on SQL Server execution plans. And so I have another agent working on the monitoring tool stuff in the background.
You’ll see that pop back up in a moment. So this Cloud has finished its analysis. And what it’s saying here is, well, let’s scroll back up a little bit.
And at any moment, the other dashboard is probably going to pop up and get in my way. But in the meantime, so we have an answer here. And Cloud is smart enough to see that we have an eager index pool.
It is 98% of the query runtime. It’s 69.726 milliseconds. And it explains what the query is doing.
All right. And it tells you that SQL Server built an index for this at runtime. And, wow, it’s roughly 32 gigs of pages.
Whoo-wee. That is a long time. All right. And it read 17.1 million rows to hand back 81,000. That’s a lot of work.
All right. And it also notes here that, well, I mean, I don’t know if I particularly agree with this. So, like, the tool can only do so much.
All right. It can still say, like, menacingly dumb things sometimes. All right. But it does understand that this is a .4 plan doing serial work and paying full freight for the privilege. Well, that’s a hell of a sentence there.
That sentence is doing some work. All right. And we see here, all right, Cloud knows that exec sync in a parallel plan indicates that an eager index pool is being built. All right.
All right. It could pop up for other reasons, but, you know, for our case, it is correct. All right. And now if we look down here, we even have Cloud smart enough to know if you create this index, my friend, the eager index pool will go away. All right.
The mechanism concretely, they both vanish from the plan if we have this index in place. All right. So it’s even cool. All right.
It’s even cool enough to know. We don’t get a missing index. We don’t get a missing index request from this plan because we don’t we don’t because SQL Server does not emit a missing index request when there is an eager index pool. All right.
So that’s good, too. All right. And it even tells you don’t waste your time with all this stuff. Just create that index. All right. So if you would like to try this new Cloud or Idiot GitHub copilot plug-in, there are a number of ways to do that. All right.
So if you would like to try this new Cloud or Idiot GitHub copilot plug-in, there are instructions to do that down in the video description along with a link to the GitHub repo where all the code lives in case you want to take a look at it. Maybe you even want to have your own robot, give it a once over to see if there’s anything that you might care about changing or contributing in there. I’m happy to take contributions on these things.
But you can do that. Anyway, thank you for watching. I hope you enjoyed yourselves. I hope you learned something. I hope you enjoyed my new Cloud and or Idiot GitHub copilot plug-in that makes execution plan analysis go a lot better than it normally would if you were to just leave the robots to their own devices because their own devices are often not very good.
So if I could say just one last thing in closing, it’s that, you know, like I feel comfortable using the robots for certain query tuning tasks. tasks because i i know enough to to tell the robots when when they’re full of it but i i worry about the the folks out there who don’t know and who get the robot saying criminally insane things to them and criminally wrong things to them and then this being like oh wow that sounds so sure of itself i ought to do that it like it’s it’s rough right like like it like like they’re they’re very good at logically like you know looking at things and logically sort of like chaining things together but um man uh the the the advice and analysis portion is uh often difficult to overcome but uh this this will hopefully make it better anyway give it a shot it’s kind of kind of fun to have uh claude not be or kind of have kind of fun to have an llm not be be completely lost in a query plan anyway thank you for watching
Going Further
If this is the kind of SQL Server stuff you love learning about, you’ll love my training. Blog readers get 25% off the Everything Bundle — over 100 hours of performance tuning content. Need hands-on help? I offer consulting engagements from targeted investigations to ongoing retainers. Want a quick sanity check before committing to a full engagement? Schedule a call — no commitment required.
The post New Claude Plugin For SQL Server Query Plan Analysis appeared first on Darling Data.