forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7741dd6
committed
Recognize self-contradictory restriction clauses for non-table relations.
The constraint exclusion feature checks for contradictions among scanrestriction clauses, as well as contradictions between those clauses and atable's CHECK constraints. The first aspect of this testing can be usefulfor non-table relations (such as subqueries or functions-in-FROM), but thefeature was coded with only the CHECK case in mind so we were applying itonly to plain-table RTEs. Move the relation_excluded_by_constraints callso that it is applied to all RTEs not just plain tables. With the defaultsetting of constraint_exclusion this results in no extra work, but withconstraint_exclusion = ON we will detect optimizations that we missedbefore (at the cost of more planner cycles than we expended before).Per a gripe from Gunnlaugur Þór Briem. Experimentation withhis example also showed we were not being very bright about the case whereconstraint exclusion is proven within a subquery within UNION ALL, so tweakthe code to allow set_append_rel_pathlist to recognize such cases.1 parent337c0b0 commit7741dd6
File tree
3 files changed
+45
-22
lines changed- src
- backend/optimizer
- path
- plan
- include/optimizer
3 files changed
+45
-22
lines changedLines changed: 39 additions & 19 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
171 | 171 |
| |
172 | 172 |
| |
173 | 173 |
| |
174 |
| - | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
175 | 186 |
| |
176 | 187 |
| |
177 | 188 |
| |
| |||
229 | 240 |
| |
230 | 241 |
| |
231 | 242 |
| |
232 |
| - | |
233 |
| - | |
234 |
| - | |
235 |
| - | |
236 |
| - | |
237 |
| - | |
238 |
| - | |
239 |
| - | |
240 |
| - | |
241 |
| - | |
242 |
| - | |
243 |
| - | |
244 |
| - | |
245 | 243 |
| |
246 | 244 |
| |
247 | 245 |
| |
| |||
439 | 437 |
| |
440 | 438 |
| |
441 | 439 |
| |
442 |
| - | |
443 |
| - | |
444 |
| - | |
445 | 440 |
| |
446 |
| - | |
447 |
| - | |
| 441 | + | |
448 | 442 |
| |
449 | 443 |
| |
450 | 444 |
| |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
451 | 457 |
| |
452 | 458 |
| |
453 | 459 |
| |
| 460 | + | |
| 461 | + | |
| 462 | + | |
454 | 463 |
| |
455 | 464 |
| |
456 | 465 |
| |
| |||
793 | 802 |
| |
794 | 803 |
| |
795 | 804 |
| |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
796 | 816 |
| |
797 | 817 |
| |
798 | 818 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
60 | 60 |
| |
61 | 61 |
| |
62 | 62 |
| |
63 |
| - | |
64 | 63 |
| |
65 | 64 |
| |
66 | 65 |
| |
| |||
1841 | 1840 |
| |
1842 | 1841 |
| |
1843 | 1842 |
| |
1844 |
| - | |
| 1843 | + | |
| 1844 | + | |
| 1845 | + | |
1845 | 1846 |
| |
1846 |
| - | |
| 1847 | + | |
1847 | 1848 |
| |
1848 | 1849 |
| |
1849 | 1850 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
35 | 35 |
| |
36 | 36 |
| |
37 | 37 |
| |
| 38 | + | |
| 39 | + | |
38 | 40 |
| |
39 | 41 |
| |
40 | 42 |
| |
|
0 commit comments
Comments
(0)