forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1083f94
committed
Be smarter about freeing tuples during tuplesorts
During dumptuples() the call to writetuple() would pfree any non-nulltuple. This was quite wasteful as this happens just before we perform areset of the context which stores all of those tuples.It seems to make sense to do a bit of a code refactor to make this work,so here we just get rid of the writetuple function and adjust the WRITETUPmacro to call the state's writetup function. The WRITETUP usage inmergeonerun() always has state->slabAllocatorUsed == true, so writetuple()would never free the tuple or do any memory accounting. The only callpath that needs memory accounting done is in dumptuples(), so let's justdo it manually there.In passing, let's get rid of the state->memtupcount-- code that counts thememtupcount down to 0 one tuple at a time inside the loop. That seems tobe a rather inefficient way to set memtupcount to 0, so let's just zero itafter the loop instead.Author: David RowleyDiscussion:https://postgr.es/m/CAApHDvqZXoDCyrfCzZJR0-xH+7_q+GgitcQiYXUjRani7h4j8Q@mail.gmail.com1 parent349baa8 commit1083f94
1 file changed
+15
-23
lines changedLines changed: 15 additions & 23 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
395 | 395 |
| |
396 | 396 |
| |
397 | 397 |
| |
398 |
| - | |
| 398 | + | |
399 | 399 |
| |
400 | 400 |
| |
401 | 401 |
| |
| |||
453 | 453 |
| |
454 | 454 |
| |
455 | 455 |
| |
456 |
| - | |
457 |
| - | |
458 | 456 |
| |
459 | 457 |
| |
460 | 458 |
| |
| |||
1339 | 1337 |
| |
1340 | 1338 |
| |
1341 | 1339 |
| |
1342 |
| - | |
1343 |
| - | |
1344 |
| - | |
1345 |
| - | |
1346 |
| - | |
1347 |
| - | |
1348 |
| - | |
1349 |
| - | |
1350 |
| - | |
1351 |
| - | |
1352 |
| - | |
1353 |
| - | |
1354 |
| - | |
1355 |
| - | |
1356 |
| - | |
1357 |
| - | |
1358 |
| - | |
1359 |
| - | |
1360 | 1340 |
| |
1361 | 1341 |
| |
1362 | 1342 |
| |
| |||
2260 | 2240 |
| |
2261 | 2241 |
| |
2262 | 2242 |
| |
| 2243 | + | |
| 2244 | + | |
2263 | 2245 |
| |
2264 | 2246 |
| |
2265 | 2247 |
| |
| |||
2418 | 2400 |
| |
2419 | 2401 |
| |
2420 | 2402 |
| |
2421 |
| - | |
2422 |
| - | |
| 2403 | + | |
| 2404 | + | |
| 2405 | + | |
| 2406 | + | |
| 2407 | + | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
2423 | 2413 |
| |
2424 | 2414 |
| |
| 2415 | + | |
| 2416 | + | |
2425 | 2417 |
| |
2426 | 2418 |
| |
2427 | 2419 |
| |
|
0 commit comments
Comments
(0)