plan
Gather
Collects tuples from parallel workers and possibly the leader. Gather does not preserve global sorted order; Gather Merge is a distinct node. PostgreSQL 17. Plan shape depends on statistics, configuration and data; example settings are laboratory aids, not production advice.
Formal Syntax & Structure
sql syntaxsql
EXPLAIN SELECT ... FROM large_tableWorking Example
Example Snippetsql
CREATE TABLE items(id integer PRIMARY KEY, category integer, price integer); INSERT INTO items VALUES (1,1,10),(2,1,20),(3,2,30); CREATE TABLE categories(id integer PRIMARY KEY, label text); INSERT INTO categories VALUES (1,'A'),(2,'B');CREATE TABLE big AS SELECT generate_series(1,100000) AS n; ANALYZE big; SET min_parallel_table_scan_size=0; SET parallel_setup_cost=0; SET parallel_tuple_cost=0; SET max_parallel_workers_per_gather=2;EXPLAIN (FORMAT JSON) SELECT count(*) FROM big;SELECT count(*) FROM big;