22-25 April 2026

Calling AI from T-SQL: Real-Life Lessons from sp_BlitzCache

Proposed session for SQLBits 2026

TL; 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.

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