EXPLAIN
statements provide information about how a query will be executed,
showing the unoptimized, optimized, and physical plans for the query.
EXPLAIN [VERBOSE] [(FORMAT format)] query
VERBOSE
: If additional details should be added to the explain.format
: Format out for the explain.query
: The query to explain.EXPLAIN
displays three forms of a query.
By default, the output is displayed in a text format showing the "base" plan, and any materializations in the plan.
Simple EXPLAIN:
EXPLAIN SELECT * FROM cities;
EXPLAIN with VERBOSE option:
EXPLAIN VERBOSE SELECT * FROM cities;
EXPLAIN with JSON format:
EXPLAIN (FORMAT JSON) SELECT * FROM cities;