QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------- Hash Join (cost=89761.10..1239195.66 rows=17 width=4) (actual time=15379.356..29315.436 rows=1182889 loops=1) Hash Cond: ((t.ps_partkey = part.p_partkey) AND (t.ps_supplycost = (SubPlan 1))) -> Seq Scan on t (cost=0.00..123281.20 rows=1593920 width=10) (actual time=0.144..934.971 rows=1604080 loops=1) -> Hash (cost=51948.26..51948.26 rows=1999989 width=4) (actual time=15376.793..15376.794 rows=1182884 loops=1) Buckets: 131072 Batches: 32 Memory Usage: 2313kB -> Index Only Scan using part_pkey on part (cost=0.43..51948.26 rows=1999989 width=4) (actual time=0.057..983.194 rows=2000000 loops=1) Heap Fetches: 0 SubPlan 1 -> Aggregate (cost=12.47..12.48 rows=1 width=32) (actual time=0.006..0.007 rows=1 loops=3182889) -> Index Scan using t_ps_partkey_idx on t t_1 (cost=0.43..12.46 rows=2 width=6) (actual time=0.003..0.004 rows=1 loops=3182889) Index Cond: (ps_partkey = part.p_partkey) Planning Time: 0.839 ms Execution Time: 29818.482 ms (13 rows)