QUERY PLAN ------------------------------------------------------------------------------------------------------------------------------------------------ Subquery Scan "temp" (cost=18237.40..18237.41 rows=1 width=121) -> Sort (cost=18237.40..18237.41 rows=1 width=121) Sort Key: nation.n_name, date_part('year'::text, orders.o_orderdate) -> Aggregate (cost=18237.38..18237.39 rows=1 width=121) -> Group (cost=18237.38..18237.39 rows=1 width=121) -> Sort (cost=18237.38..18237.38 rows=1 width=121) Sort Key: nation.n_name, date_part('year'::text, orders.o_orderdate) -> Nested Loop (cost=18232.96..18237.37 rows=1 width=121) -> Hash Join (cost=18232.96..18234.34 rows=1 width=109) Hash Cond: ("outer".n_nationkey = "inner".s_nationkey) -> Seq Scan on nation (cost=0.00..1.25 rows=25 width=33) -> Hash (cost=18232.95..18232.95 rows=1 width=76) -> Nested Loop (cost=0.00..18232.95 rows=1 width=76) Join Filter: ("inner".s_suppkey = "outer".l_suppkey) -> Nested Loop (cost=0.00..18229.93 rows=1 width=68) Join Filter: ("outer".p_partkey = "inner".l_partkey) -> Nested Loop (cost=0.00..8021.14 rows=4 width=23) -> Seq Scan on part (cost=0.00..8018.00 rows=1 width=4) Filter: (p_name ~~ '%aquamarine%'::text) -> Index Scan using i_ps_partkey on partsupp (cost=0.00..3.07 rows=5 width=19) Index Cond: ("outer".p_partkey = partsupp.ps_partkey) -> Index Scan using i_l_suppkey on lineitem (cost=0.00..2542.69 rows=634 width=45) Index Cond: ("outer".ps_suppkey = lineitem.l_suppkey) -> Index Scan using pk_supplier on supplier (cost=0.00..3.01 rows=1 width=8) Index Cond: ("outer".ps_suppkey = supplier.s_suppkey) -> Index Scan using pk_orders on orders (cost=0.00..3.01 rows=1 width=12) Index Cond: (orders.o_orderkey = "outer".l_orderkey) (27 rows)