- Notifications
You must be signed in to change notification settings - Fork5
Commita2e092e
committed
Don't MAXALIGN in the checks to decide whether a tuple is over TOAST's
threshold for tuple length. On 4-byte-MAXALIGN machines, the toast codecreates tuples that have t_len exactly TOAST_TUPLE_THRESHOLD ... but thisnumber is not itself maxaligned, so if heap_insert maxaligns t_len beforecomparing to TOAST_TUPLE_THRESHOLD, it'll uselessly recurse back totuptoaster.c, wasting cycles. (It turns out that this does not happen on8-byte-MAXALIGN machines, because for them the outer MAXALIGN in theTOAST_MAX_CHUNK_SIZE macro reduces TOAST_MAX_CHUNK_SIZE so that toast tupleswill be less than TOAST_TUPLE_THRESHOLD in size. That MAXALIGN is reallyincorrect, but we can't remove it now, see below.) There isn't any particularvalue in maxaligning before comparing to the thresholds, so just don't dothat, which saves a small number of cycles in itself.These numbers should be rejiggered to minimize wasted space on toast-relationpages, but we can't do that in the back branches because changingTOAST_MAX_CHUNK_SIZE would force an initdb (by changing the contents of toasttables). We can move the toast decision thresholds a bit, though, which iswhat this patch effectively does.Thanks to Pavan Deolasee for discovering the unintended recursion.Back-patch into 8.2, but not further, pending more testing. (HEAD is aboutto get a further patch modifying the thresholds, so it won't help muchfor testing this form of the patch.)1 parent03d442c commita2e092e
File tree
3 files changed
+31
-24
lines changed- src
- backend/access/heap
- include/access
3 files changed
+31
-24
lines changedLines changed: 6 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
1418 | 1418 |
| |
1419 | 1419 |
| |
1420 | 1420 |
| |
1421 |
| - | |
1422 |
| - | |
| 1421 | + | |
1423 | 1422 |
| |
1424 | 1423 |
| |
1425 | 1424 |
| |
| |||
2073 | 2072 |
| |
2074 | 2073 |
| |
2075 | 2074 |
| |
2076 |
| - | |
2077 |
| - | |
2078 | 2075 |
| |
2079 | 2076 |
| |
2080 |
| - | |
| 2077 | + | |
2081 | 2078 |
| |
2082 | 2079 |
| |
2083 | 2080 |
| |
| 2081 | + | |
| 2082 | + | |
2084 | 2083 |
| |
2085 | 2084 |
| |
2086 | 2085 |
| |
| |||
2100 | 2099 |
| |
2101 | 2100 |
| |
2102 | 2101 |
| |
2103 |
| - | |
| 2102 | + | |
2104 | 2103 |
| |
2105 | 2104 |
| |
2106 | 2105 |
| |
|
Lines changed: 19 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
506 | 506 |
| |
507 | 507 |
| |
508 | 508 |
| |
| 509 | + | |
| 510 | + | |
509 | 511 |
| |
510 | 512 |
| |
511 | 513 |
| |
512 |
| - | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
513 | 520 |
| |
514 | 521 |
| |
515 | 522 |
| |
516 | 523 |
| |
517 |
| - | |
518 |
| - | |
519 |
| - | |
| 524 | + | |
| 525 | + | |
520 | 526 |
| |
521 | 527 |
| |
522 | 528 |
| |
| |||
575 | 581 |
| |
576 | 582 |
| |
577 | 583 |
| |
578 |
| - | |
579 |
| - | |
580 |
| - | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
581 | 587 |
| |
582 | 588 |
| |
583 | 589 |
| |
| |||
627 | 633 |
| |
628 | 634 |
| |
629 | 635 |
| |
630 |
| - | |
631 |
| - | |
632 |
| - | |
| 636 | + | |
| 637 | + | |
633 | 638 |
| |
634 | 639 |
| |
635 | 640 |
| |
| |||
687 | 692 |
| |
688 | 693 |
| |
689 | 694 |
| |
690 |
| - | |
691 |
| - | |
692 |
| - | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
693 | 698 |
| |
694 | 699 |
| |
695 | 700 |
| |
|
Lines changed: 6 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
9 |
| - | |
| 9 | + | |
10 | 10 |
| |
11 | 11 |
| |
12 | 12 |
| |
| |||
26 | 26 |
| |
27 | 27 |
| |
28 | 28 |
| |
29 |
| - | |
30 |
| - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 |
| |
32 | 35 |
| |
33 | 36 |
| |
|
0 commit comments
Comments
(0)