EXPLAIN
Show the query execution plan without running the query.
Syntax
Parameters
| Parameter | Description |
|---|---|
| statement | The SQL statement to explain (typically a SELECT) |
ANALYZE | Actually execute the statement and show real timing and row counts |
(LOGICAL) | Show the logical query plan |
(EXECUTION) | Show the physical execution plan |
Examples
Basic explain
EXPLAIN SELECT * FROM articles WHERE category = 'engineering';
Explain with actual execution
EXPLAIN ANALYZE SELECT category, COUNT(*) FROM articles GROUP BY category;