Plan nodes · Set operations and appends

SetOp

Computes INTERSECT or EXCEPT.

Counts how often each distinct row appears in each input, with a hash table (Hashed) or over sorted input (Sorted), and returns the rows that the operation keeps.

Example

SELECT country FROM artists INTERSECT SELECT country FROM artists WHERE id < 10

3 nodes

Run with EXPLAIN (ANALYZE, BUFFERS, TIMING OFF, SUMMARY OFF) on the sample database, PostgreSQL 19.0. Open it in the EXPLAIN visualizer →

Related

Append · Merge Append · Recursive Union