- Notifications
You must be signed in to change notification settings - Fork5k
Commit3b35f9a

Richard Guo
Fix an incorrect check in get_memoize_path
Memoize typically marks cache entries as complete after fully scanningthe inner side of a join. However, in the case of unique joins, weskip to the next outer tuple as soon as the first matching inner tupleis found, leaving no opportunity to scan the inner side to completion.To work around that, we mark cache entries as complete after fetchingthe first matching inner tuple in unique joins.This approach is only safe when all of the join's restriction clausesare parameterized; otherwise, there is no guarantee that reading justone tuple from the inner side is sufficient.Currently, we check for this by verifying that the number of clausesin ppi_clauses is no less than the number of the join's restrictionclauses. However, this check isn't entirely reliable, as ppi_clausesincludes join clauses available from all outer rels, not just thecurrent outer rel. This means the check could pass even if arestriction clause isn't parameterized, as long as another joinclause, which doesn't belong to the current join, is included inppi_clauses.To fix this, we explicitly check whether each restriction clause ofthe current join is present in ppi_clauses.While we're here, remove the XXX comment from the modified code, asit's not justified; in certain cases, it's not possible to move a joinclause to the inner side.This is arguably a bugfix, but no backpatch given the lack of fieldreports.Author: Richard Guo <guofenglinux@gmail.com>Reviewed-by: wenhui qiu <qiuwenhuifx@gmail.com>Reviewed-by: Andrei Lepikhov <lepihov@gmail.com>Discussion:https://postgr.es/m/CAMbWs4-8JPouj=wBDj4DhK-WO4+Xdx=A2jbjvvyyTBQneJ1=BQ@mail.gmail.com1 parent5ee4762 commit3b35f9a
1 file changed
+15
-9
lines changedLines changed: 15 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
748 | 748 |
| |
749 | 749 |
| |
750 | 750 |
| |
751 |
| - | |
752 |
| - | |
753 |
| - | |
754 |
| - | |
755 | 751 |
| |
756 |
| - | |
757 |
| - | |
758 |
| - | |
759 |
| - | |
760 |
| - | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
761 | 767 |
| |
762 | 768 |
| |
763 | 769 |
| |
|
0 commit comments
Comments
(0)