forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit9c6ad5e
committed
YA attempt at taming worst-case behavior of get_actual_variable_range.
We've made multiple attempts at preventing get_actual_variable_rangefrom taking an unreasonable amount of time (3ca930f,fccebe4).But there's still an issue for the very first planning attempt afterdeletion of a large number of extremal-valued tuples. While thatplanning attempt will set "killed" bits on the tuples it visits andthereby reduce effort for next time, there's still a lot of work ithas to do to visit the heap and then set those bits. It's (usually?)not worth it to do that much work at plan time to have a slightlybetter estimate, especially in a context like this where the tablecontents are known to be mutating rapidly.Therefore, let's bound the amount of work to be done by giving upafter we've visited 100 heap pages. Giving up just means we'llfall back on the extremal value recorded in pg_statistic, so itshouldn't mean that planner estimates suddenly become worthless.Note that this means we'll still gradually whittle down the problemby setting a few more index "killed" bits in each planning attempt;so eventually we'll reach a good state (barring further deletions),even in the absence of VACUUM.Simon Riggs, per a complaint from Jakub Wartak (with cosmeticadjustments by me). Back-patch to all supported branches.Discussion:https://postgr.es/m/CAKZiRmznOwi0oaV=4PHOCM4ygcH4MgSvt8=5cu_vNCfc8FSUug@mail.gmail.com1 parent0538d4c commit9c6ad5e
1 file changed
+40
-5
lines changedLines changed: 40 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5964 | 5964 |
| |
5965 | 5965 |
| |
5966 | 5966 |
| |
5967 |
| - | |
| 5967 | + | |
5968 | 5968 |
| |
5969 | 5969 |
| |
5970 | 5970 |
| |
| |||
6093 | 6093 |
| |
6094 | 6094 |
| |
6095 | 6095 |
| |
6096 |
| - | |
| 6096 | + | |
6097 | 6097 |
| |
6098 | 6098 |
| |
6099 | 6099 |
| |
6100 |
| - | |
| 6100 | + | |
6101 | 6101 |
| |
6102 | 6102 |
| |
6103 | 6103 |
| |
| |||
6131 | 6131 |
| |
6132 | 6132 |
| |
6133 | 6133 |
| |
6134 |
| - | |
| 6134 | + | |
6135 | 6135 |
| |
6136 | 6136 |
| |
6137 | 6137 |
| |
| |||
6141 | 6141 |
| |
6142 | 6142 |
| |
6143 | 6143 |
| |
| 6144 | + | |
| 6145 | + | |
| 6146 | + | |
6144 | 6147 |
| |
6145 | 6148 |
| |
6146 | 6149 |
| |
| |||
6157 | 6160 |
| |
6158 | 6161 |
| |
6159 | 6162 |
| |
| 6163 | + | |
| 6164 | + | |
6160 | 6165 |
| |
6161 | 6166 |
| |
6162 | 6167 |
| |
| |||
6199 | 6204 |
| |
6200 | 6205 |
| |
6201 | 6206 |
| |
| 6207 | + | |
| 6208 | + | |
| 6209 | + | |
| 6210 | + | |
| 6211 | + | |
| 6212 | + | |
6202 | 6213 |
| |
6203 | 6214 |
| |
6204 | 6215 |
| |
| |||
6213 | 6224 |
| |
6214 | 6225 |
| |
6215 | 6226 |
| |
| 6227 | + | |
| 6228 | + | |
6216 | 6229 |
| |
6217 |
| - | |
| 6230 | + | |
6218 | 6231 |
| |
6219 | 6232 |
| |
6220 | 6233 |
| |
6221 | 6234 |
| |
| 6235 | + | |
| 6236 | + | |
| 6237 | + | |
| 6238 | + | |
| 6239 | + | |
| 6240 | + | |
| 6241 | + | |
| 6242 | + | |
| 6243 | + | |
| 6244 | + | |
| 6245 | + | |
| 6246 | + | |
| 6247 | + | |
| 6248 | + | |
| 6249 | + | |
| 6250 | + | |
| 6251 | + | |
| 6252 | + | |
| 6253 | + | |
| 6254 | + | |
| 6255 | + | |
6222 | 6256 |
| |
| 6257 | + | |
6223 | 6258 |
| |
6224 | 6259 |
| |
6225 | 6260 |
| |
|
0 commit comments
Comments
(0)