Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardSQLnested-loop joinSingle-choice MCQ

A nested-loop join's EXPLAIN ANALYZE shows the inner Index Scan with `loops=1` even though the outer side returned 50,000 rows. The plan also contains a `Materialize` node between the join and the inner relation. What is the Materialize node doing here, and why does loops=1 make sense?

Nested Loop -> Seq Scan on outer (rows=50000) -> Materialize -> Index Scan on inner (loops=1)