Calling AI from T-SQL: Real-Life Lessons from sp_BlitzCache
Proposed session for SQLBits 2026TL; DR
Brent Ozar cuts through AI hype with real-world lessons from calling LLMs inside sp_BlitzCache. Learn how to pick models, write effective prompts, pass the right context, handle failures, and use AI safely from your own stored procedures.
Session Details
Brent Ozar hates the AI hype just as much as you do, but the thing is, there are useful real-world places where AI's advice is quick, easy, and cheap.
In this session, Brent Ozar shares hard-won, real-world lessons from integrating AI into the widely used open-source tools sp_BlitzCache and sp_BlitzIndex. He'll show how those stored procedures call AI models such as ChatGPT, Google Gemini, Anthropic, and even local models—then turn those responses into actionable performance advice.
You’ll see what worked, what failed, and what surprised him in real production environments. You'll learn how to choose the right model for the job, craft prompts that return useful answers, decide what additional context to send (and what to leave out), and see how to safely integrate AI calls into dynamic SQL. You’ll even learn how to handle API failures, unpredictable responses, and the very human support questions that came up once real DBAs started using AI-assisted performance tuning.
If you’re curious about calling AI from your own stored procedures—but want practical guidance, realistic expectations, and enterprise-ready patterns—this session will give you a clear, usable roadmap.
In this session, Brent Ozar shares hard-won, real-world lessons from integrating AI into the widely used open-source tools sp_BlitzCache and sp_BlitzIndex. He'll show how those stored procedures call AI models such as ChatGPT, Google Gemini, Anthropic, and even local models—then turn those responses into actionable performance advice.
You’ll see what worked, what failed, and what surprised him in real production environments. You'll learn how to choose the right model for the job, craft prompts that return useful answers, decide what additional context to send (and what to leave out), and see how to safely integrate AI calls into dynamic SQL. You’ll even learn how to handle API failures, unpredictable responses, and the very human support questions that came up once real DBAs started using AI-assisted performance tuning.
If you’re curious about calling AI from your own stored procedures—but want practical guidance, realistic expectations, and enterprise-ready patterns—this session will give you a clear, usable roadmap.
3 things you'll get out of this session
Learn how to pick a model and craft a good prompt
Understand what context needs to be sent along with the prompt
Learn how to integrate it all with dynamic SQL
Speakers
Brent Ozar's other proposed sessions for 2026
20 Years of the Cloud: What Changed, What Didn’t, and What’s Next - 2026
AI in Your Career: Sidekick, Hero, or Villain? - 2026
Dev-Prod Demon Hunters: Finding the Real Cause of Production Slowness - 2026
Pokémon Battle, Choose Your Index: You Can’t Have Them All - 2026
The Big Red Button: How to Use sp_Kill - 2026
Watch Brent Tune a Query in SQL Server 2025 - 2026