Query plan node structure
EXPLAIN
output is organized into a series of plan nodes. At the lowest level there are nodes that look at tables, scanning them, or looking things up with an index. Higher level nodes take the output from the lower level ones and operate on it. When you run EXPLAIN
, each line in the output is a plan node.
Each node has several numeric measurements associated with it as well:
# EXPLAIN ANALYZE SELECT * FROM customers; QUERY PLAN ---------- Seq Scan on customers (cost=0.00..676.00 rows=20000 width=268) (actual time=0.011..34.489 rows=20000 loops=1) Total runtime: 65.804 ms
This plan has one node, a Seq Scan
node. The first set of numbers reported are the plan estimates, which are the only thing you see if you run EXPLAIN
without ANALYZE
:
cost=0.00..676.00
: The first cost here is the startup cost of the node. That's how much work is estimated before this node produces its first row of output. In this...