QUERY PLAN -------------------------------------------------------------------------------- Hash Right Join (cost=76.57..116.64 rows=59 width=16) Hash Cond: (b.i = a.i) -> Seq Scan on tab1 b (cost=0.00..31.40 rows=2140 width=8) -> Hash (cost=76.50..76.50 rows=6 width=8) -> Hash Join (cost=73.64..76.50 rows=6 width=8) Hash Cond: (tab2.k = a.i) -> HashAggregate (cost=36.75..38.75 rows=200 width=4) -> Seq Scan on tab2 (cost=0.00..31.40 rows=2140 width=4) -> Hash (cost=36.75..36.75 rows=11 width=8) -> Seq Scan on tab1 a (cost=0.00..36.75 rows=11 width=8) Filter: (i = j) (11 rows)