O'Reilly logo

PostgreSQL 9.0 High Performance by Gregory Smith

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required