forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit581df21

Richard Guo
Fix rowcount estimate for gather (merge) paths
In the case of a parallel plan, when computing the number of tuplesprocessed per worker, we divide the total number of tuples by theparallel_divisor obtained from get_parallel_divisor(), which accountsfor the leader's contribution in addition to the number of workers.Accordingly, when estimating the number of tuples for gather (merge)nodes, we should multiply the number of tuples per worker by the sameparallel_divisor to reverse the division. However, currently we useparallel_workers rather than parallel_divisor for the multiplication.This could result in an underestimation of the number of tuples forgather (merge) nodes, especially when there are fewer than fourworkers.This patch fixes this issue by using the same parallel_divisor for themultiplication. There is one ensuing plan change in the regressiontests, but it looks reasonable and does not compromise its originalpurpose of testing parallel-aware hash join.In passing, this patch removes an unnecessary assignment for path.rowsin create_gather_merge_path, and fixes an uninitialized-variable issuein generate_useful_gather_paths.No backpatch as this could result in plan changes.Author: Anthonin BonnefoyReviewed-by: Rafia Sabih, Richard GuoDiscussion:https://postgr.es/m/CAO6_Xqr9+51NxgO=XospEkUeAg-p=EjAWmtpdcZwjRgGKJ53iA@mail.gmail.com1 parentd2cba4f commit581df21
File tree
6 files changed
+33
-20
lines changed- src
- backend/optimizer
- path
- plan
- util
- include/optimizer
- test/regress/expected
6 files changed
+33
-20
lines changedLines changed: 3 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3079 | 3079 |
| |
3080 | 3080 |
| |
3081 | 3081 |
| |
3082 |
| - | |
3083 |
| - | |
| 3082 | + | |
3084 | 3083 |
| |
3085 | 3084 |
| |
3086 | 3085 |
| |
| |||
3098 | 3097 |
| |
3099 | 3098 |
| |
3100 | 3099 |
| |
3101 |
| - | |
| 3100 | + | |
3102 | 3101 |
| |
3103 | 3102 |
| |
3104 | 3103 |
| |
| |||
3282 | 3281 |
| |
3283 | 3282 |
| |
3284 | 3283 |
| |
3285 |
| - | |
3286 | 3284 |
| |
3287 | 3285 |
| |
3288 | 3286 |
| |
| |||
3291 | 3289 |
| |
3292 | 3290 |
| |
3293 | 3291 |
| |
| 3292 | + | |
3294 | 3293 |
| |
3295 | 3294 |
| |
3296 | 3295 |
| |
|
Lines changed: 18 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6473 | 6473 |
| |
6474 | 6474 |
| |
6475 | 6475 |
| |
| 6476 | + | |
| 6477 | + | |
| 6478 | + | |
| 6479 | + | |
| 6480 | + | |
| 6481 | + | |
| 6482 | + | |
| 6483 | + | |
| 6484 | + | |
| 6485 | + | |
| 6486 | + | |
| 6487 | + | |
| 6488 | + | |
| 6489 | + | |
| 6490 | + | |
| 6491 | + | |
| 6492 | + | |
| 6493 | + |
Lines changed: 2 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5370 | 5370 |
| |
5371 | 5371 |
| |
5372 | 5372 |
| |
5373 |
| - | |
5374 |
| - | |
| 5373 | + | |
5375 | 5374 |
| |
5376 | 5375 |
| |
5377 | 5376 |
| |
| |||
7543 | 7542 |
| |
7544 | 7543 |
| |
7545 | 7544 |
| |
7546 |
| - | |
7547 |
| - | |
7548 | 7545 |
| |
7549 | 7546 |
| |
7550 | 7547 |
| |
| |||
7561 | 7558 |
| |
7562 | 7559 |
| |
7563 | 7560 |
| |
7564 |
| - | |
| 7561 | + | |
7565 | 7562 |
| |
7566 | 7563 |
| |
7567 | 7564 |
| |
|
Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1899 | 1899 |
| |
1900 | 1900 |
| |
1901 | 1901 |
| |
1902 |
| - | |
1903 | 1902 |
| |
1904 | 1903 |
| |
1905 | 1904 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
212 | 212 |
| |
213 | 213 |
| |
214 | 214 |
| |
| 215 | + | |
215 | 216 |
| |
216 | 217 |
|
Lines changed: 9 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
508 | 508 |
| |
509 | 509 |
| |
510 | 510 |
| |
511 |
| - | |
512 |
| - | |
513 |
| - | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
514 | 514 |
| |
515 | 515 |
| |
516 |
| - | |
517 |
| - | |
518 |
| - | |
519 |
| - | |
520 |
| - | |
521 |
| - | |
522 |
| - | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
523 | 522 |
| |
524 | 523 |
| |
525 | 524 |
| |
|
0 commit comments
Comments
(0)