QUERY PLAN --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Limit (cost=2379390.80..2379390.80 rows=1 width=16) (actual time=54907.020..56488.940 rows=1 loops=1) -> Sort (cost=2379390.80..2379391.30 rows=200 width=16) (actual time=54907.017..56488.936 rows=1 loops=1) Sort Key: (count(*)) DESC, (count(orders.o_orderkey)) DESC Sort Method: top-N heapsort Memory: 25kB -> Finalize GroupAggregate (cost=2379288.01..2379389.80 rows=200 width=16) (actual time=54906.806..56488.887 rows=46 loops=1) Group Key: (count(orders.o_orderkey)) -> Gather Merge (cost=2379288.01..2379383.80 rows=800 width=16) (actual time=54906.750..56488.772 rows=221 loops=1) Workers Planned: 4 Workers Launched: 4 -> Sort (cost=2378287.95..2378288.45 rows=200 width=16) (actual time=54683.493..54683.504 rows=44 loops=5) Sort Key: (count(orders.o_orderkey)) DESC Sort Method: quicksort Memory: 27kB Worker 0: Sort Method: quicksort Memory: 27kB Worker 1: Sort Method: quicksort Memory: 27kB Worker 2: Sort Method: quicksort Memory: 27kB Worker 3: Sort Method: quicksort Memory: 27kB -> Partial HashAggregate (cost=2378278.31..2378280.31 rows=200 width=16) (actual time=54683.396..54683.416 rows=44 loops=5) Group Key: count(orders.o_orderkey) Batches: 1 Memory Usage: 40kB Worker 0: Batches: 1 Memory Usage: 40kB Worker 1: Batches: 1 Memory Usage: 40kB Worker 2: Batches: 1 Memory Usage: 40kB Worker 3: Batches: 1 Memory Usage: 40kB -> Parallel BatchHashAggregate (cost=2247028.31..2265778.31 rows=1875000 width=12) (actual time=42669.256..54057.855 rows=1500000 loops=5) Group Key: customer.c_custkey -> Parallel Hash Left Join (cost=1847584.01..2081722.28 rows=18560606 width=8) (actual time=26526.618..35499.518 rows=15338754 loops=5) Hash Cond: (customer.c_custkey = orders.o_custkey) -> Parallel Index Only Scan using customer_pkey on customer (cost=0.43..138518.43 rows=1875000 width=4) (actual time=0.264..396.064 rows=1500000 loops=5) Heap Fetches: 0 -> Parallel Hash (cost=1615576.00..1615576.00 rows=18560606 width=12) (actual time=26371.486..26371.487 rows=14838729 loops=5) Buckets: 67108864 Batches: 1 Memory Usage: 4005568kB -> Parallel Seq Scan on orders (cost=0.00..1615576.00 rows=18560606 width=12) (actual time=0.261..17049.899 rows=14838729 loops=5) Filter: ((o_comment)::text !~~ '%express%packages%'::text) Rows Removed by Filter: 161271 Planning Time: 15.787 ms Execution Time: 57090.387 ms (36 rows) c_count | custdist ---------+---------- 0 | 2500124 (1 row)