QUERY PLAN ---------------------------------------------------------------------------------------------------------------------------------------------------------- Sort (cost=7781667.06..7781667.06 rows=1 width=192) Sort Key: supplier.s_acctbal DESC, nation.n_name, supplier.s_name, part.p_partkey -> Nested Loop (cost=0.43..7781667.05 rows=1 width=192) Join Filter: (nation.n_regionkey = region.r_regionkey) -> Nested Loop (cost=0.43..7781665.97 rows=1 width=196) Join Filter: (supplier.s_nationkey = nation.n_nationkey) -> Nested Loop (cost=0.43..7781664.41 rows=1 width=170) Join Filter: (partsupp.ps_suppkey = supplier.s_suppkey) -> Nested Loop (cost=0.43..7777198.41 rows=1 width=34) -> Seq Scan on part (cost=0.00..70961.83 rows=8829 width=30) Filter: (((p_type)::text ~~ '%NICKEL'::text) AND (p_size = 16)) -> Index Scan using idx_partsupp_partkey on partsupp (cost=0.43..872.82 rows=1 width=14) Index Cond: (ps_partkey = part.p_partkey) Filter: ((SubPlan 1) = ps_supplycost) SubPlan 1 -> Aggregate (cost=48.33..48.34 rows=1 width=32) -> Nested Loop (cost=0.72..48.32 rows=4 width=6) Join Filter: (supplier_1.s_nationkey = nation_1.n_nationkey) -> Nested Loop (cost=0.72..44.33 rows=18 width=10) -> Index Scan using idx_partsupp_partkey on partsupp partsupp_1 (cost=0.43..2.75 rows=18 width=10) Index Cond: (ps_partkey = part.p_partkey) -> Index Scan using supplier_pkey on supplier supplier_1 (cost=0.29..2.31 rows=1 width=8) Index Cond: (s_suppkey = partsupp_1.ps_suppkey) -> Materialize (cost=0.00..2.65 rows=5 width=4) -> Nested Loop (cost=0.00..2.62 rows=5 width=4) Join Filter: (nation_1.n_regionkey = region_1.r_regionkey) -> Seq Scan on region region_1 (cost=0.00..1.06 rows=1 width=4) Filter: (r_name = 'AMERICA'::bpchar) -> Seq Scan on nation nation_1 (cost=0.00..1.25 rows=25 width=8) -> Seq Scan on supplier (cost=0.00..3216.00 rows=100000 width=144) -> Seq Scan on nation (cost=0.00..1.25 rows=25 width=34) -> Seq Scan on region (cost=0.00..1.06 rows=1 width=4) Filter: (r_name = 'AMERICA'::bpchar) (33 rows)