QUERY PLAN -------------------------------------------------------------------------- Nested Loop (cost=0.00..84113.00 rows=2880000 width=8) -> Seq Scan on tab1 a (cost=0.00..34.00 rows=2400 width=4) -> Materialize (cost=0.00..48082.00 rows=1200 width=4) -> Seq Scan on tab2 b (cost=0.00..48076.00 rows=1200 width=4) Filter: (SubPlan 1) SubPlan 1 -> Seq Scan on tab3 (cost=0.00..40.00 rows=12 width=4) Filter: (k = b.j) (8 rows) QUERY PLAN -------------------------------------------------------------------------- Nested Loop (cost=0.00..84113.00 rows=2880000 width=8) -> Seq Scan on tab2 b (cost=0.00..34.00 rows=2400 width=4) -> Materialize (cost=0.00..48082.00 rows=1200 width=4) -> Seq Scan on tab1 a (cost=0.00..48076.00 rows=1200 width=4) Filter: (SubPlan 1) SubPlan 1 -> Seq Scan on tab3 (cost=0.00..40.00 rows=12 width=4) Filter: (k = a.i) (8 rows) QUERY PLAN -------------------------------------------------------------------------- Nested Loop Left Join (cost=0.00..84113.00 rows=2880000 width=8) -> Seq Scan on tab1 a (cost=0.00..34.00 rows=2400 width=4) -> Materialize (cost=0.00..48082.00 rows=1200 width=4) -> Seq Scan on tab2 b (cost=0.00..48076.00 rows=1200 width=4) Filter: (SubPlan 1) SubPlan 1 -> Seq Scan on tab3 (cost=0.00..40.00 rows=12 width=4) Filter: (k = b.j) (8 rows) QUERY PLAN ----------------------------------------------------------------------- Nested Loop Left Join (cost=0.00..115372874.00 rows=2880000 width=8) Join Filter: (SubPlan 1) -> Seq Scan on tab1 a (cost=0.00..34.00 rows=2400 width=4) -> Materialize (cost=0.00..46.00 rows=2400 width=4) -> Seq Scan on tab2 b (cost=0.00..34.00 rows=2400 width=4) SubPlan 1 -> Seq Scan on tab3 (cost=0.00..40.00 rows=12 width=4) Filter: (k = a.i) (8 rows) QUERY PLAN ----------------------------------------------------------------------- Nested Loop Left Join (cost=0.00..115372874.00 rows=2880000 width=8) Join Filter: (SubPlan 1) -> Seq Scan on tab1 a (cost=0.00..34.00 rows=2400 width=4) -> Materialize (cost=0.00..46.00 rows=2400 width=4) -> Seq Scan on tab2 b (cost=0.00..34.00 rows=2400 width=4) SubPlan 1 -> Seq Scan on tab3 (cost=0.00..40.00 rows=12 width=4) Filter: (k = b.j) (8 rows)