plan
Append
Concatenates tuples from child plans, commonly for UNION ALL or partitions. It does not remove duplicates or guarantee SQL result ordering. 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 ... UNION ALL SELECT ...Working 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');
EXPLAIN (FORMAT JSON) SELECT id FROM items WHERE category=1 UNION ALL SELECT id FROM items WHERE category=2 ORDER BY id;SELECT id FROM items WHERE category=1 UNION ALL SELECT id FROM items WHERE category=2 ORDER BY id;