forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit52579d5
committed
Fix GEQO to not assume its join order heuristic always works.
Back in commit400e2c9 I rewrote GEQO'sgimme_tree function to improve its heuristic for modifying the given tourinto a legal join order. In what can only be called a fit of hubris,I supposed that this new heuristic would *always* find a legal join order,and ripped out the old logic that allowed gimme_tree to sometimes fail.The folly of this is exposed by bug #12760, in which the "greedy" clumpingbehavior of merge_clump() can lead it into a dead end which could only berecovered from by un-clumping. We have no code for that and wouldn't knowexactly what to do with it if we did. Rather than try to improve theheuristic rules still further, let's just recognize that it *is* aheuristic and probably must always have failure cases. So, put back thecode removed in the previous commit to allow for failure (but comment ita bit better this time).It's possible that this code was actually fully correct at the time andhas only been broken by the introduction of LATERAL. But having seen thisexample I no longer have much faith in that proposition, so back-patch toall supported branches.1 parent0d36d9f commit52579d5
File tree
3 files changed
+49
-9
lines changed- src/backend/optimizer/geqo
3 files changed
+49
-9
lines changedLines changed: 21 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
49 | 49 |
| |
50 | 50 |
| |
51 | 51 |
| |
| 52 | + | |
| 53 | + | |
| 54 | + | |
52 | 55 |
| |
53 | 56 |
| |
54 | 57 |
| |
| |||
101 | 104 |
| |
102 | 105 |
| |
103 | 106 |
| |
104 |
| - | |
| 107 | + | |
105 | 108 |
| |
106 | 109 |
| |
107 | 110 |
| |
108 | 111 |
| |
109 |
| - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
110 | 120 |
| |
111 | 121 |
| |
112 | 122 |
| |
| |||
131 | 141 |
| |
132 | 142 |
| |
133 | 143 |
| |
134 |
| - | |
| 144 | + | |
| 145 | + | |
135 | 146 |
| |
136 | 147 |
| |
137 | 148 |
| |
| |||
144 | 155 |
| |
145 | 156 |
| |
146 | 157 |
| |
147 |
| - | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
148 | 162 |
| |
149 | 163 |
| |
150 | 164 |
| |
| |||
161 | 175 |
| |
162 | 176 |
| |
163 | 177 |
| |
164 |
| - | |
165 |
| - | |
166 |
| - | |
| 178 | + | |
| 179 | + | |
167 | 180 |
| |
168 | 181 |
| |
169 | 182 |
| |
| |||
205 | 218 |
| |
206 | 219 |
| |
207 | 220 |
| |
208 |
| - | |
| 221 | + | |
209 | 222 |
| |
210 | 223 |
| |
211 | 224 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
261 | 261 |
| |
262 | 262 |
| |
263 | 263 |
| |
| 264 | + | |
| 265 | + | |
| 266 | + | |
264 | 267 |
| |
265 | 268 |
| |
266 | 269 |
| |
|
Lines changed: 25 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
92 | 92 |
| |
93 | 93 |
| |
94 | 94 |
| |
| 95 | + | |
95 | 96 |
| |
96 |
| - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
97 | 107 |
| |
98 | 108 |
| |
99 | 109 |
| |
100 | 110 |
| |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
101 | 119 |
| |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
102 | 126 |
| |
103 | 127 |
| |
104 | 128 |
| |
|
0 commit comments
Comments
(0)