QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=1901120.62..1901120.62 rows=1 width=192) (actual time=10998.473..11000.664 rows=4737 loops=1) Sort Key: supplier.s_acctbal DESC, nation.n_name, supplier.s_name, part.p_partkey Sort Method: quicksort Memory: 1469kB -> Merge Join (cost=638655.36..1901120.61 rows=1 width=192) (actual time=7299.121..10993.517 rows=4737 loops=1) Merge Cond: (part.p_partkey = partsupp.ps_partkey) Join Filter: (partsupp.ps_supplycost = (SubPlan 1)) Rows Removed by Join Filter: 1661 -> Index Scan using part_pkey on part (cost=0.43..102913.21 rows=8829 width=30) (actual time=0.142..412.621 rows=8046 loops=1) Filter: (((p_type)::text ~~ '%NICKEL'::text) AND (p_size = 16)) Rows Removed by Filter: 1991954 -> Materialize (cost=638654.72..646656.44 rows=1600344 width=172) (actual time=7298.795..9539.910 rows=1603828 loops=1) -> Sort (cost=638654.72..642655.58 rows=1600344 width=172) (actual time=7298.781..8178.512 rows=1603828 loops=1) Sort Key: partsupp.ps_partkey Sort Method: external merge Disk: 293504kB -> Nested Loop (cost=42.10..200242.67 rows=1600344 width=172) (actual time=2.873..5427.412 rows=1604080 loops=1) -> Nested Loop (cost=41.67..2184.07 rows=20000 width=166) (actual time=2.805..74.435 rows=20051 loops=1) -> Nested Loop (cost=0.14..13.95 rows=5 width=30) (actual time=0.112..0.192 rows=5 loops=1) Join Filter: (nation.n_regionkey = region.r_regionkey) Rows Removed by Join Filter: 20 -> Index Scan using nation_pkey on nation (cost=0.14..12.51 rows=25 width=34) (actual time=0.025..0.047 rows=25 loops=1) -> Materialize (cost=0.00..1.07 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=25) -> Seq Scan on region (cost=0.00..1.06 rows=1 width=4) (actual time=0.027..0.032 rows=1 loops=1) Filter: (r_name = 'AMERICA'::bpchar) Rows Removed by Filter: 4 -> Bitmap Heap Scan on supplier (cost=41.53..394.02 rows=4000 width=144) (actual time=0.853..10.520 rows=4010 loops=5) Recheck Cond: (s_nationkey = nation.n_nationkey) Heap Blocks: exact=9388 -> Bitmap Index Scan on idx_supplier_nation_key (cost=0.00..40.53 rows=4000 width=0) (actual time=0.532..0.532 rows=4010 loops=5) Index Cond: (s_nationkey = nation.n_nationkey) -> Index Scan using idx_partsupp_suppkey on partsupp (cost=0.43..9.09 rows=81 width=14) (actual time=0.006..0.195 rows=80 loops=20051) Index Cond: (ps_suppkey = supplier.s_suppkey) SubPlan 1 -> Aggregate (cost=162.40..162.41 rows=1 width=32) (actual time=0.043..0.044 rows=1 loops=6398) -> Nested Loop (cost=0.86..162.39 rows=4 width=6) (actual time=0.022..0.040 rows=2 loops=6398) Join Filter: (nation_1.n_regionkey = region_1.r_regionkey) Rows Removed by Join Filter: 2 -> Seq Scan on region region_1 (cost=0.00..1.06 rows=1 width=4) (actual time=0.001..0.002 rows=1 loops=6398) Filter: (r_name = 'AMERICA'::bpchar) Rows Removed by Filter: 4 -> Nested Loop (cost=0.86..161.10 rows=18 width=10) (actual time=0.012..0.034 rows=4 loops=6398) -> Nested Loop (cost=0.72..158.33 rows=18 width=10) (actual time=0.010..0.024 rows=4 loops=6398) -> Index Scan using idx_partsupp_partkey on partsupp partsupp_1 (cost=0.43..8.75 rows=18 width=10) (actual time=0.005..0.008 rows=4 loops=6398) Index Cond: (ps_partkey = part.p_partkey) -> Index Scan using supplier_pkey on supplier supplier_1 (cost=0.29..8.31 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=25592) Index Cond: (s_suppkey = partsupp_1.ps_suppkey) -> Index Scan using nation_pkey on nation nation_1 (cost=0.14..0.16 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=25592) Index Cond: (n_nationkey = supplier_1.s_nationkey) Planning Time: 3.406 ms Execution Time: 11034.252 ms (49 rows)