plan
Materialize
Caches input tuples for rescans, avoiding repeated execution of a child plan. May use temporary storage; not equivalent to creating a materialized view. 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 a CROSS JOIN bWorking 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');SET enable_material=on;EXPLAIN (FORMAT JSON) SELECT i.id,c.id FROM items i CROSS JOIN categories c ORDER BY i.id,c.id;SELECT i.id,c.id FROM items i CROSS JOIN categories c ORDER BY i.id,c.id;