Skip to main content

EXPLAIN

Show the query execution plan without running the query.

Syntax

Parameters

ParameterDescription
statementThe SQL statement to explain (typically a SELECT)
ANALYZEActually 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;

See also