EXPLAIN select ps_partkey, sum(ps_supplycost * ps_availqty) as value from partsupp, supplier, nation where ps_suppkey = s_suppkey and s_nationkey = n_nationkey and n_name = 'RUSSIA' group by ps_partkey having sum(ps_supplycost * ps_availqty) > ( select sum(ps_supplycost * ps_availqty) * 0.0000100000 from partsupp, supplier, nation where ps_suppkey = s_suppkey and s_nationkey = n_nationkey and n_name = 'RUSSIA' ) order by value desc; plan ------------------------------------------------------------- sort join bnl map groupby groupby join hash join hash join tablescan hash partsupp join tablescan hash partsupp tablescan tablescan nation supplier tablescan tablescan nation supplier (17 rows)