forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitaa901a3
committed
Fix possible Assert failure in cost_memoize_rescan
In cost_memoize_rescan(), when calculating the hit_ratio using the callsand ndistinct estimations, if the value that was set inMemoizePath.calls had not been processed through clamp_row_est(), then itwas possible that it was set to some non-integer value which could resultin ndistinct being 1 higher than calls due to estimate_num_groups()performing clamp_row_est() on its input_rows. This could result inhit_ratio values slightly below 0.0, which would cause an Assert failure.The value of MemoizePath.calls comes from the final parameter in thecreate_memoize_path() function, of which we only have one true caller of.That caller passes outer_path->rows. All the core code I looked atalways seems to call clamp_row_est() on the Path.rows, so there mighthave been no issues with any core Paths causing troubles here. The bugreport was about a CustomPath with a non-clamped row estimated.The misbehavior as a result of this seems to be mostly limited to theAssert() failing. Aside from that, it seems the Memoize costs wouldjust come out slightly higher than they should have, which is likelyfairly harmless.Reported-by: Kohei KaiGai <kaigai@heterodb.com>Discussion:https://postgr.es/m/CAOP8fzZnTU+N64UYJYogb1hN-5hFP+PwTb3m_cnGAD7EsQwrKw@mail.gmail.comReviewed-by: Richard GuoBackpatch-through: 14, where Memoize was introduced1 parent5603e11 commitaa901a3
1 file changed
+1
-1
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1618 | 1618 |
| |
1619 | 1619 |
| |
1620 | 1620 |
| |
1621 |
| - | |
| 1621 | + | |
1622 | 1622 |
| |
1623 | 1623 |
| |
1624 | 1624 |
| |
|
0 commit comments
Comments
(0)