Skip to Content

How does EXPLAIN ANALYZE differ from a recall dashboard?

Category: SQL for AI Engineering

Answer

EXPLAIN ANALYZE measures query plan cost (rows read, plan used, time). Recall@K measures correctness. The two answer different questions: “is it fast?” and “is it right?”. Run both in CI: a query might be perfect at 50 ms using 100% of the right rows, OR perfect at 5 sec using 80% — only one is the right shipping shape.

Concrete examples from the fca project context

Example 1

EXPLAIN ANALYZE: outputs rows scanned, plan used, time-to-finish.

Example 2

Recall@K: did the predicted K contain the labelled row?

Example 3

Together: “fast and correct” is a deployable query. “Fast but wrong” or “right but 10x slower” both block ship.

Data flow / flow chart

EXPLAIN ANALYZE -> fast yes/no (with what plan)
  Recall@K   -> right  yes/no (with what trade-off)
  (both answer different questions about the same query)

Takeaway

Always evaluate query plans AND query correctness in CI; one without the other lies.