- Notifications
You must be signed in to change notification settings - Fork28
Commita1feb90
committed
Fix an oversight in the code that makes transitive-equality deductions from
outer join clauses. Given, say,... from a left join b on a.a1 = b.b1 where a.a1 = 42;we'll deduce a clause b.b1 = 42 and then mark the original join clauseredundant (we can't remove it completely for reasons I don't feel likesqueezing into this log entry). However the original implementation ofthat wasn't bulletproof, because clause_selectivity() wouldn't honorthis_selec if given nonzero varRelid --- which in practice meant thatit worked as desired *except* when considering index scan quals. Whichresulted in bogus underestimation of the size of the indexscan result foran inner indexscan in an outer join, and consequently a possibly badchoice of indexscan vs. bitmap scan. Fix by introducing an explicit testinto clause_selectivity(). Also, to make sure we don't trigger that testin corner cases, change the convention to be that this_selec > 1, notthis_selec = 1, means it's been marked redundant. Per trouble report fromScara Maccai.Back-patch to 8.2, where the problem was introduced.1 parent7fb2753 commita1feb90
File tree
4 files changed
+16
-8
lines changed- src
- backend
- nodes
- optimizer/path
- include/nodes
4 files changed
+16
-8
lines changedLines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
1563 | 1563 |
| |
1564 | 1564 |
| |
1565 | 1565 |
| |
| 1566 | + | |
1566 | 1567 |
| |
1567 | 1568 |
| |
1568 | 1569 |
| |
|
Lines changed: 7 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
513 | 513 |
| |
514 | 514 |
| |
515 | 515 |
| |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
516 | 522 |
| |
517 | 523 |
| |
518 | 524 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
13 |
| - | |
| 13 | + | |
14 | 14 |
| |
15 | 15 |
| |
16 | 16 |
| |
| |||
1198 | 1198 |
| |
1199 | 1199 |
| |
1200 | 1200 |
| |
1201 |
| - | |
| 1201 | + | |
1202 | 1202 |
| |
1203 | 1203 |
| |
1204 | 1204 |
| |
| |||
1220 | 1220 |
| |
1221 | 1221 |
| |
1222 | 1222 |
| |
1223 |
| - | |
| 1223 | + | |
1224 | 1224 |
| |
1225 | 1225 |
| |
1226 | 1226 |
| |
| |||
1242 | 1242 |
| |
1243 | 1243 |
| |
1244 | 1244 |
| |
1245 |
| - | |
| 1245 | + | |
1246 | 1246 |
| |
1247 | 1247 |
| |
1248 | 1248 |
| |
|
Lines changed: 3 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
991 | 991 |
| |
992 | 992 |
| |
993 | 993 |
| |
994 |
| - | |
| 994 | + | |
| 995 | + | |
995 | 996 |
| |
996 | 997 |
| |
997 | 998 |
| |
|
0 commit comments
Comments
(0)