work_mem=20MB TPCH10 local machine (centos) HEAD: postgres=# \i 6.explain.sql QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------- Limit (cost=1574273.30..1574273.31 rows=1 width=32) (actual time=11945.353..11945.354 rows=1 loops=1) -> Aggregate (cost=1574273.30..1574273.31 rows=1 width=32) (actual time=11945.351..11945.351 rows=1 loops=1) -> Bitmap Heap Scan on lineitem (cost=300139.79..1568589.61 rows=1136737 width=12) (actual time=2791.050..11028.483 rows=1140100 loops=1) Recheck Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01 00:00:00'::timestamp without time zone) AND (l_discount >= 0.06 ) AND (l_discount <= 0.08) AND (l_quantity < '24'::numeric)) Rows Removed by Index Recheck: 12717683 Heap Blocks: exact=397368 lossy=267461 -> Bitmap Index Scan on idx_lineitem_shipdate (cost=0.00..299855.60 rows=1136737 width=0) (actual time=2616.866..2616.866 rows=1140100 loops= 1) Index Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01 00:00:00'::timestamp without time zone) AND (l_discount >= 0.06) AND (l_discount <= 0.08) AND (l_quantity < '24'::numeric)) Planning time: 0.997 ms Execution time: 11953.947 ms (10 rows) PATCH: postgres=# set max_parallel_workers_per_gather=0; SET postgres=# \i 6.explain.sql QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------- Limit (cost=1574273.30..1574273.31 rows=1 width=32) (actual time=11894.663..11894.664 rows=1 loops=1) -> Aggregate (cost=1574273.30..1574273.31 rows=1 width=32) (actual time=11894.662..11894.662 rows=1 loops=1) -> Bitmap Heap Scan on lineitem (cost=300139.79..1568589.61 rows=1136737 width=12) (actual time=2728.421..11018.894 rows=1140100 loops=1) Recheck Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01 00:00:00'::timestamp without time zone) AND (l_discount >= 0.06 ) AND (l_discount <= 0.08) AND (l_quantity < '24'::numeric)) Rows Removed by Index Recheck: 12717683 Heap Blocks: exact=397368 lossy=267461 -> Bitmap Index Scan on idx_lineitem_shipdate (cost=0.00..299855.60 rows=1136737 width=0) (actual time=2556.135..2556.135 rows=1140100 loops= 1) Index Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01 00:00:00'::timestamp without time zone) AND (l_discount >= 0.06) AND (l_discount <= 0.08) AND (l_quantity < '24'::numeric)) Planning time: 0.309 ms Execution time: 11905.105 ms (10 rows) postgres=# set max_parallel_workers_per_gather=2; SET postgres=# \i 6.explain.sql QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------------------------------------- ----------------------------------------------------------------------------- Limit (cost=1557038.36..1557038.37 rows=1 width=32) (actual time=6423.900..6423.900 rows=1 loops=1) -> Finalize Aggregate (cost=1557038.36..1557038.37 rows=1 width=32) (actual time=6423.899..6423.899 rows=1 loops=1) -> Gather (cost=1557038.14..1557038.35 rows=2 width=32) (actual time=6420.236..6423.881 rows=3 loops=1) Workers Planned: 2 Workers Launched: 2 -> Partial Aggregate (cost=1556038.14..1556038.15 rows=1 width=32) (actual time=6416.089..6416.089 rows=1 loops=3) -> Parallel Bitmap Heap Scan on lineitem (cost=300139.79..1553669.94 rows=473640 width=12) (actual time=2767.552..6092.416 rows=380033 loops=3) Recheck Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01 00:00:00'::timestamp without time zone) AND (l_disc ount >= 0.06) AND (l_discount <= 0.08) AND (l_quantity < '24'::numeric)) Rows Removed by Index Recheck: 4239228 Heap Blocks: exact=129782 lossy=87203 -> Bitmap Index Scan on idx_lineitem_shipdate (cost=0.00..299855.60 rows=1136737 width=0) (actual time=2542.716..2542.716 rows=11 40100 loops=1) Index Cond: ((l_shipdate >= '1994-01-01'::date) AND (l_shipdate < '1995-01-01 00:00:00'::timestamp without time zone) AND (l_ discount >= 0.06) AND (l_discount <= 0.08) AND (l_quantity < '24'::numeric)) Planning time: 0.269 ms Execution time: 6439.755 ms (14 rows)