postgrespro/vops

bug with PG10 parallel?

Closed this issue · 1 comments

HI,
I use vops with PG 10 beta1, but when i query the countall with parallel, the result is not correct.
Is it a bug?

the real count is :

postgres=# set max_parallel_workers_per_gather =0;
SET
Time: 0.153 ms
postgres=# select countall(*) from vc;
 countall  
-----------
 150000000
(1 row)
Time: 933.433 ms

parallel

ostgres=# set max_parallel_workers_per_gather =2;
SET
Time: 0.110 ms
postgres=# select countall(*) from vc;
 countall 
----------
 71552512
(1 row)

Time: 503.081 ms
postgres=# explain select countall(*) from vc;
                                      QUERY PLAN                                       
---------------------------------------------------------------------------------------
 Finalize Aggregate  (cost=179617.95..179617.96 rows=1 width=8)
   ->  Gather  (cost=179617.94..179617.95 rows=2 width=8)
         Workers Planned: 2
         ->  Partial Aggregate  (cost=179617.94..179617.95 rows=1 width=8)
               ->  Parallel Seq Scan on vc  (cost=0.00..177176.55 rows=976555 width=0)
(5 rows)

Time: 0.313 ms


postgres=# set max_parallel_workers_per_gather =4;
SET
Time: 0.134 ms
postgres=# explain select countall(*) from vc;
                                      QUERY PLAN                                       
---------------------------------------------------------------------------------------
 Finalize Aggregate  (cost=174735.18..174735.19 rows=1 width=8)
   ->  Gather  (cost=174735.16..174735.17 rows=4 width=8)
         Workers Planned: 4
         ->  Partial Aggregate  (cost=174735.16..174735.17 rows=1 width=8)
               ->  Parallel Seq Scan on vc  (cost=0.00..173270.33 rows=585933 width=0)
(5 rows)

Time: 0.331 ms
postgres=# select countall(*) from vc;
 countall 
----------
 46793600
(1 row)

Time: 351.865 ms

best regards, thank you.

Fixed by commit d153055..8bdc710