Commit 50a38f6
committed
Create memory context for HashAgg with a reasonable maxBlockSize.
If the memory context's maxBlockSize is too big, a single block
allocation can suddenly exceed work_mem. For Hash Aggregation, this
can mean spilling to disk too early or reporting a confusing memory
usage number for EXPLAN ANALYZE.
Introduce CreateWorkExprContext(), which is like CreateExprContext(),
except that it creates the AllocSet with a maxBlockSize that is
reasonable in proportion to work_mem.
Right now, CreateWorkExprContext() is only used by Hash Aggregation,
but it may be generally useful in the future.
Discussion: https://postgr.es/m/412a3fbf306f84d8d78c4009e11791867e62b87c.camel@j-davis.com1 parent f0705bb commit 50a38f6
File tree
3 files changed
+58
-19
lines changed- src
- backend/executor
- include/executor
3 files changed
+58
-19
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
227 | 228 | | |
228 | 229 | | |
229 | 230 | | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
242 | 234 | | |
243 | | - | |
244 | | - | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
245 | 238 | | |
246 | 239 | | |
247 | 240 | | |
| |||
264 | 257 | | |
265 | 258 | | |
266 | 259 | | |
267 | | - | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
268 | 263 | | |
269 | 264 | | |
270 | 265 | | |
| |||
294 | 289 | | |
295 | 290 | | |
296 | 291 | | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
297 | 338 | | |
298 | 339 | | |
299 | 340 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3277 | 3277 | | |
3278 | 3278 | | |
3279 | 3279 | | |
3280 | | - | |
3281 | | - | |
3282 | | - | |
3283 | | - | |
| 3280 | + | |
3284 | 3281 | | |
3285 | 3282 | | |
3286 | 3283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
| 496 | + | |
496 | 497 | | |
497 | 498 | | |
498 | 499 | | |
| |||
0 commit comments