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 things you see if you run ...

Get PostgreSQL 10 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.