Skip to main content

AI for Database Administrators

The AI + Database Landscape

AI + Azure SQL — Three Categories
🤖
AI Built INTO Azure SQL
Automatic Tuning, Intelligent Insights, IQP, Query Performance Insight
💬
AI Tools FOR DBAs
Copilot in Azure SQL, Azure Data Studio, Azure Portal, GitHub Copilot
🧬
AI Capabilities WITH SQL
Vector Search, Azure OpenAI (RAG), Azure AI Search, T-SQL PREDICT (ONNX)

Part 1: AI Already Built Into Azure SQL

These features work automatically — no AI expertise needed.

Automatic Tuning (Already in Your Wiki)

Azure SQL automatically:

  • FORCE_LAST_GOOD_PLAN: Detects query plan regression → reverts to previous good plan
  • CREATE_INDEX: Identifies missing indexes → creates them automatically
  • DROP_INDEX: Finds unused indexes → removes them to save write overhead

Intelligent Insights

ML engine analyzes Query Store + metrics and detects:

  • Queries timing out more often
  • Wait times increasing
  • Plan regressions
  • TempDB contention patterns

Output: JSON diagnostics log → viewable in Azure Portal, Log Analytics, or Power BI.

Intelligent Query Processing (IQP)

The optimizer learns and adapts at runtime:

FeatureWhat AI Does
Memory Grant FeedbackLearns optimal memory for each query over multiple executions
Adaptive JoinsDecides hash vs nested loop at runtime based on actual row counts
DOP FeedbackAuto-adjusts parallelism degree based on past performance
CE FeedbackCorrects cardinality estimates using execution feedback
Parameter Sensitive PlanCreates multiple plan variants for different parameter ranges
🎯 Exam Focus

These features are the exam's way of testing "AI in databases" without calling it AI. IQP = machine learning applied to query optimization. It learns from execution history and adapts plans accordingly.


Part 2: AI Copilot Tools for DBAs

Copilot in Azure SQL Database (Preview)

Natural language interface for database administration.

🗣️
DBA Types
"Show me the top 10 slowest queries today"
🤖
Copilot in Azure SQL
Understands schema
Generates T-SQL
📝
Output
SELECT TOP 10 ... FROM sys.dm_exec_query_stats
+ plain English explanation

What it can do:

  • Generate T-SQL from natural language descriptions
  • Explain existing queries in plain English
  • Suggest performance improvements
  • Help build monitoring queries
  • Generate index recommendations with context

Copilot in Azure Data Studio

CapabilityExample
Generate queries"Write a query to find all customers who ordered in the last 30 days but not in the last 7"
Explain plans"Why is this execution plan doing a table scan?"
Fix errors"This query fails with error 8152 — what's wrong?"
Optimize"How can I make this query faster?"

GitHub Copilot for SQL Development

Your everyday coding assistant — already in VS Code:

  • Autocomplete SQL queries as you type
  • Generate stored procedures from comments
  • Convert between dialects (Oracle PL/SQL → T-SQL)
  • Write migration scripts
  • Generate test data
🏢 Real-World DBA Note

Your competitive advantage: As a DCSA who builds with Copilot (your MCP dashboard has 16 tools!) AND understands database internals, you can show customers how AI + databases work together. Most DBAs are either pure infra OR pure AI — you bridge both.


Part 3: Building AI Applications WITH Azure SQL

Vector Search in Azure SQL

Azure SQL can store and search vector embeddings — the foundation of modern AI applications.

RAG Pattern (Retrieval-Augmented Generation)
📄
1. Store
Documents + embeddings
in Azure SQL VECTOR column
🔍
2. Search
User question → embed
VECTOR_DISTANCE similarity
🎯
3. Context
Top 5 relevant passages
from vector search
🧠
4. Generate
Azure OpenAI GPT-4
+ context = accurate answer

Key T-SQL for vector search:

-- Create a table with a vector column
CREATE TABLE KnowledgeBase (
Id INT PRIMARY KEY,
Content NVARCHAR(MAX),
ContentVector VECTOR(1536) -- 1536 dimensions for text-embedding-3-small
);

-- Find similar content using cosine distance
SELECT TOP 5 Id, Content,
VECTOR_DISTANCE('cosine', ContentVector, @queryVector) AS distance
FROM KnowledgeBase
ORDER BY VECTOR_DISTANCE('cosine', ContentVector, @queryVector);
🎯 Exam Focus

Vector search in Azure SQL is a new capability (2024+). While not heavily tested on DP-300 yet, it's the future of AI + databases. Understanding it positions you for both the exam and real-world AI projects.

Azure OpenAI + Azure SQL Integration

PatternArchitectureUse Case
RAG (Retrieval-Augmented Gen)SQL stores documents + embeddings → search → feed to LLMKnowledge base Q&A, chatbots
Text-to-SQLUser asks question → LLM generates SQL → executes on DBNatural language reporting
SummarizationSQL query results → LLM summarizesExecutive dashboards
ClassificationSQL data → LLM classifies/tagsAuto-categorize support tickets
Anomaly narrationIntelligent Insights detects anomaly → LLM explains in plain EnglishAlert enrichment

T-SQL + PREDICT (In-Database ML)

Run machine learning models inside Azure SQL — no data movement needed.

🔄
Traditional ML
Extract data from SQL → Process in Python/R → Send predictions back to SQL
In-Database ML (PREDICT)
Data stays in SQL → ONNX Model loaded in DB → PREDICT() returns results in T-SQL query

Benefits of in-database ML:

  • No data movement — data stays in SQL (security + performance)
  • Real-time scoring — PREDICT() runs as part of a T-SQL query
  • ONNX format — train in Python/R, export to ONNX, deploy to SQL

Azure AI Search + Azure SQL

For full-text and semantic search beyond what SQL's built-in FTS offers:

🗄️
Azure SQL Database
Source of truth
Transactions, data
🔍
Azure AI Search
Indexer (auto-sync)
Hybrid: keyword + vector + semantic
🎯
Ranked Results
Intelligent search
Synonym support
Vector similarity

Use case: Your wiki content, customer data, or product catalog stored in Azure SQL → Azure AI Search provides intelligent search with semantic understanding, synonym support, and vector similarity.

🏢 Real-World DBA Note

Your AzureDigest project already uses Azure OpenAI. Imagine extending it: store article summaries in Azure SQL with vector embeddings → search for relevant past articles semantically → generate context-aware daily digests. That's RAG in action.


Part 4: AI-Powered Database Monitoring

The Future DBA Workflow

🛠️
Today (Manual)
Check dashboards → Query DMVs → Analyze plans → Implement fix
🤖
Tomorrow (AI-Assisted)
Copilot alerts: "Query X regressed 300%" → Suggests: "Force plan #4 or add covering index" → You approve → Auto-applied

What's Available Now

AI CapabilityAvailable InStatus
Automatic plan forcingAzure SQL DB, MIGA
Automatic index creationAzure SQL DBGA (opt-in)
Intelligent InsightsAzure SQL DB, MIGA
IQP (all features)SQL 2022 / Azure SQLGA
Copilot in Azure SQLAzure SQL DBPreview
Vector searchAzure SQL DBPreview
PREDICT (ONNX models)Azure SQL DB, MI, VMGA
Copilot in Azure Data StudioAzure Data StudioPreview

Flashcards

What AI features are built into Azure SQL automatically?
Click to reveal answer
1) Automatic Tuning (force plans, create/drop indexes). 2) Intelligent Insights (ML anomaly detection). 3) IQP (adaptive joins, memory grant feedback, DOP feedback, CE feedback, PSP optimization).
1 / 6

Quiz

Q1/3
0 correct
A company wants to build a knowledge base chatbot using their data stored in Azure SQL. Which AI pattern should they use?