One of my clients contacted me because their database was having frequent deadlocks. If you are not familiar with deadlocks, it is when two processes are holding resources and blocking each other from proceeding. It is a bit like gridlock for a database.
Traditionally, troubleshooting deadlocks is a somewhat painful process of checking logs for details of the deadlock, identifying the code involved, and then reviewing exactly what is causing the deadlock.
I decided to see if using AI could help streamline the process. I copied the XML deadlock report from the server into Microsoft Copilot and asked it to analyze it. It came back quickly with the root cause and identified the stored procedures or triggers involved.
I then scripted out the code involved, saved them to files, and asked Copilot to do its thing with the code attached. It gave me options to address the deadlock and offered fixes for the code to implement them. This saved me hours of analysis.
However, I realized having me in the middle to find the deadlocks, extract the code and prompt the AI to process it was inefficient. I went ahead and wrote a program to take care of the whole process. While I was at it, I also added the ability to analyze indexes and review code.
After seeing the great results it provided, I wanted to share this with the world and AI SQL Tuner was born.
I hope you find it useful as well. If you have any feedback or suggestions, don’t hesitate to reach out!
Give it a try for free or choose a paid subscription.
