dalibo / pev2

Postgres Explain Visualizer 2
https://explain.dalibo.com
PostgreSQL License
2.49k stars 119 forks source link

Incorrect calculation of the total number of estimated / real rows in some parallel plans #604

Open yhuelf opened 1 year ago

yhuelf commented 1 year ago

In this plan, the inner side of the join is executed in full for each worker and the leader. This means that every process must have a private copy of the hash. Therefore, it is inappropriate to multiply the number of rows by "loops" in this case (nodes 5 and 6).

See here for further details : https://www.postgresql.org/docs/current/parallel-plans.html#PARALLEL-JOINS

yhuelf commented 1 year ago

Compare with the parallel hash join for the same query.

The only difference with before is a RESET enable_parallel_hash;

https://explain.dalibo.com/plan/f11gg33e19adf0dh

yhuelf commented 1 year ago

Same problem with a merge join, of course, as per the documentation

https://explain.dalibo.com/plan/56a23c086073a315

MatteoGioioso commented 11 months ago

Noticed the same, when workers are present the rows in the plan are the average returned per worker despite the number of loops.