← Docs
Recipe

SQL EXPLAIN plan explainer

Feed Meridian a query plan and get back a plain-English walkthrough of every node, cost, and bottleneck.

Ingredients

  • Raw EXPLAIN output from PostgreSQL, MySQL, or SQLite
  • Optional: table row counts and index definitions
  • Optional: slow-query-log threshold in ms

What you get

  • Node-by-node translation of scan types, join strategies, and sort operations
  • Cost breakdown: startup cost, total cost, estimated rows vs actual
  • Bottleneck flagging: sequential scans on large tables, missing indexes, hash-join spills
  • Actionable rewrite suggestions with before/after snippets

Example prompt

EXPLAIN ANALYZE SELECT o.id, c.name
FROM orders o
JOIN customers c ON o.customer_id = c.id
WHERE o.created_at > '2025-01-01'
ORDER BY o.total DESC LIMIT 50;

-- Table: orders (2.3M rows, indexed on customer_id, created_at)
-- Table: customers (180K rows, PK id)

Pro tip

Paste the full EXPLAIN (ANALYZE, BUFFERS, FORMAT JSON) output for the deepest analysis. Meridian reads the JSON tree natively and catches buffer-miss patterns that text-format plans hide.