forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1e731ed
committed
Fix incorrect row estimates used for Memoize costing
In order to estimate the cache hit ratio of a Memoize node, one of theinputs we require is the estimated number of times the Memoize node willbe rescanned. The higher this number, the large the cache hit ratio islikely to become. Unfortunately, the value being passed as the number of"calls" to the Memoize was incorrectly using the Nested Loop'souter_path->parent->rows instead of outer_path->rows. This failed toaccount for the fact that the outer_path might be parameterized by someupper-level Nested Loop.This problem could lead to Memoize plans appearing more favorable thanthey might actually be. It could also lead to extended executor startuptimes when work_mem values were large due to the planner setting overlylarge MemoizePath->est_entries resulting in the Memoize hash table beinginitially made much larger than might be required.Fix this simply by passing outer_path->rows rather thanouter_path->parent->rows. Also, adjust the expected regression testoutput for a plan change.Reported-by: Pavel StehuleAuthor: David RowleyDiscussion:https://postgr.es/m/CAFj8pRAMp%3DQsMi6sPQJ4W3hczoFJRvyXHJV3AZAZaMyTVM312Q%40mail.gmail.comBackpatch-through: 14, where Memoize was introduced1 parent5bcc4d0 commit1e731ed
File tree
2 files changed
+11
-17
lines changed- src
- backend/optimizer/path
- test/regress/expected
2 files changed
+11
-17
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
610 | 610 |
| |
611 | 611 |
| |
612 | 612 |
| |
613 |
| - | |
| 613 | + | |
614 | 614 |
| |
615 | 615 |
| |
616 | 616 |
| |
|
Lines changed: 10 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3673 | 3673 |
| |
3674 | 3674 |
| |
3675 | 3675 |
| |
3676 |
| - | |
3677 |
| - | |
| 3676 | + | |
| 3677 | + | |
3678 | 3678 |
| |
3679 | 3679 |
| |
3680 | 3680 |
| |
| |||
3684 | 3684 |
| |
3685 | 3685 |
| |
3686 | 3686 |
| |
3687 |
| - | |
3688 |
| - | |
3689 |
| - | |
3690 |
| - | |
3691 |
| - | |
3692 |
| - | |
| 3687 | + | |
| 3688 | + | |
| 3689 | + | |
3693 | 3690 |
| |
3694 | 3691 |
| |
3695 | 3692 |
| |
3696 | 3693 |
| |
3697 | 3694 |
| |
3698 | 3695 |
| |
3699 |
| - | |
3700 |
| - | |
| 3696 | + | |
| 3697 | + | |
3701 | 3698 |
| |
3702 | 3699 |
| |
3703 | 3700 |
| |
| |||
3707 | 3704 |
| |
3708 | 3705 |
| |
3709 | 3706 |
| |
3710 |
| - | |
3711 |
| - | |
3712 |
| - | |
3713 |
| - | |
3714 |
| - | |
3715 |
| - | |
| 3707 | + | |
| 3708 | + | |
| 3709 | + | |
3716 | 3710 |
| |
3717 | 3711 |
| |
3718 | 3712 |
| |
|
0 commit comments
Comments
(0)