AI Query Explanation
Explain a SQL script section by section in a dedicated dialog with a clear query preview, readable markdown output, and a separately configurable explain model.
How the current flow works
What does the dialog show?
The Query panel
Shows the exact SQL being explained with line numbers so you can track each section. This makes the explanation much easier to verify than reading one long blob of text.
The Explanation panel
Shows formatted markdown for readability. This is where the AI explains the purpose of each section, the overall logic, and any important caveats.
WITH monthly_revenue AS (
SELECT DATE_TRUNC('month', o.created_at) AS month,
u.id AS user_id,
SUM(o.total_amount) AS revenue
FROM orders o
JOIN users u ON o.user_id = u.id
WHERE o.status = 'completed'
GROUP BY 1, 2
)
SELECT user_id, month, revenue FROM monthly_revenue;
Which model is used for explanations?
Share the Assistant model
This is the simplest option when you want a minimal configuration and do not need a quality split between chat and explain.
Use a dedicated Explain model
Great when you want query explanations to use a model specialized for step-by-step analysis, clearer prose, or lower cost than the main assistant.
When should you use it?
Read legacy queries
Useful when revisiting old scripts, stored procedures, or teammate queries without tracing every line manually.
Understand logic before editing
Helps you understand intent before optimizing, splitting steps, or rewriting the statement so you do not edit blindly.
Faster onboarding
New team members can understand complex queries faster without searching every syntax form or window function by hand.
AI Query Explanation is a natural-language explanation layer, not the database engine’s real `EXPLAIN` / `EXPLAIN ANALYZE` output. If you need an actual execution plan for performance debugging, use the workspace plan/analyze tooling.
Ready to explore data?
Join the community on GitHub to contribute to the smartest local database IDE.
Launch App