forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitb0eaa4c

Amit Kapila
Avoid creation of the free space map for small heap relations, take 2.
Previously, all heaps had FSMs. For very small tables, this means that theFSM took up more space than the heap did. This is wasteful, so now werefrain from creating the FSM for heaps with 4 pages or fewer. If the lastknown target block has insufficient space, we still try to insert into someother page before giving up and extending the relation, since doingotherwise leads to table bloat. Testing showed that trying every pagepenalized performance slightly, so we compromise and try every other page.This way, we visit at most two pages. Any pages with wasted free spacebecome visible at next relation extension, so we still control table bloat.As a bonus, directly attempting one or two pages can even be faster thanconsulting the FSM would have been.Once the FSM is created for a heap we don't remove it even if somebodydeletes all the rows from the corresponding relation. We don't think it isa useful optimization as it is quite likely that relation will again growto the same size.Author: John Naylor, Amit KapilaReviewed-by: Amit KapilaTested-by: Mithun C YDiscussion:https://www.postgresql.org/message-id/CAJVSVGWvB13PzpbLEecFuGFc5V2fsO736BsdTakPiPAcdMM5tQ@mail.gmail.com1 parentbe12aa4 commitb0eaa4c
File tree
16 files changed
+543
-102
lines changed- contrib/pageinspect
- expected
- sql
- doc/src/sgml
- src
- backend
- access
- brin
- heap
- transam
- storage/freespace
- include/storage
- test/regress
- expected
- sql
16 files changed
+543
-102
lines changedLines changed: 39 additions & 38 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 |
| - | |
3 |
| - | |
4 |
| - | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
5 | 7 |
| |
6 | 8 |
| |
7 |
| - | |
| 9 | + | |
8 | 10 |
| |
9 | 11 |
| |
10 | 12 |
| |
11 | 13 |
| |
12 | 14 |
| |
13 |
| - | |
14 |
| - | |
15 |
| - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
16 | 18 |
| |
17 | 19 |
| |
18 | 20 |
| |
19 | 21 |
| |
20 | 22 |
| |
21 |
| - | |
22 |
| - | |
23 |
| - | |
24 |
| - | |
25 |
| - | |
26 |
| - | |
27 |
| - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
28 | 26 |
| |
29 | 27 |
| |
30 | 28 |
| |
31 | 29 |
| |
32 | 30 |
| |
33 |
| - | |
34 |
| - | |
| 31 | + | |
| 32 | + | |
35 | 33 |
| |
36 | 34 |
| |
37 |
| - | |
| 35 | + | |
38 | 36 |
| |
39 | 37 |
| |
40 |
| - | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
41 | 59 |
| |
42 | 60 |
| |
43 | 61 |
| |
44 | 62 |
| |
45 | 63 |
| |
| 64 | + | |
| 65 | + | |
| 66 | + | |
46 | 67 |
| |
47 | 68 |
| |
48 | 69 |
| |
| |||
62 | 83 |
| |
63 | 84 |
| |
64 | 85 |
| |
65 |
| - | |
66 |
| - | |
67 |
| - | |
68 |
| - | |
69 |
| - | |
70 |
| - | |
71 |
| - | |
72 |
| - | |
73 |
| - | |
74 |
| - | |
75 |
| - | |
76 |
| - | |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
81 |
| - | |
82 |
| - | |
83 |
| - | |
84 |
| - | |
85 | 86 |
| |
86 | 87 |
| |
87 | 88 |
| |
|
Lines changed: 20 additions & 13 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1 | 1 |
| |
2 | 2 |
| |
3 |
| - | |
4 |
| - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
5 | 6 |
| |
6 |
| - | |
| 7 | + | |
| 8 | + | |
7 | 9 |
| |
8 | 10 |
| |
9 | 11 |
| |
10 | 12 |
| |
11 |
| - | |
12 |
| - | |
| 13 | + | |
| 14 | + | |
13 | 15 |
| |
14 |
| - | |
15 |
| - | |
| 16 | + | |
| 17 | + | |
16 | 18 |
| |
17 |
| - | |
18 |
| - | |
| 19 | + | |
| 20 | + | |
19 | 21 |
| |
20 | 22 |
| |
21 |
| - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
22 | 28 |
| |
23 |
| - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
24 | 33 |
| |
25 | 34 |
| |
26 | 35 |
| |
| |||
29 | 38 |
| |
30 | 39 |
| |
31 | 40 |
| |
32 |
| - | |
33 |
| - | |
34 | 41 |
| |
35 | 42 |
| |
36 | 43 |
| |
|
Lines changed: 7 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
590 | 590 |
| |
591 | 591 |
| |
592 | 592 |
| |
593 |
| - | |
594 |
| - | |
595 |
| - | |
596 |
| - | |
597 |
| - | |
598 |
| - | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
599 | 600 |
| |
600 | 601 |
| |
601 | 602 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1150 | 1150 |
| |
1151 | 1151 |
| |
1152 | 1152 |
| |
1153 |
| - | |
| 1153 | + | |
1154 | 1154 |
| |
1155 | 1155 |
| |
1156 | 1156 |
| |
|
Lines changed: 5 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
310 | 310 |
| |
311 | 311 |
| |
312 | 312 |
| |
313 |
| - | |
| 313 | + | |
314 | 314 |
| |
315 | 315 |
| |
316 | 316 |
| |
| |||
461 | 461 |
| |
462 | 462 |
| |
463 | 463 |
| |
464 |
| - | |
| 464 | + | |
465 | 465 |
| |
466 | 466 |
| |
467 | 467 |
| |
| |||
654 | 654 |
| |
655 | 655 |
| |
656 | 656 |
| |
657 |
| - | |
| 657 | + | |
658 | 658 |
| |
659 | 659 |
| |
660 | 660 |
| |
| |||
703 | 703 |
| |
704 | 704 |
| |
705 | 705 |
| |
706 |
| - | |
| 706 | + | |
707 | 707 |
| |
708 | 708 |
| |
709 | 709 |
| |
| |||
895 | 895 |
| |
896 | 896 |
| |
897 | 897 |
| |
898 |
| - | |
| 898 | + | |
899 | 899 |
| |
900 | 900 |
| |
901 | 901 |
| |
|
Lines changed: 28 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
246 | 246 |
| |
247 | 247 |
| |
248 | 248 |
| |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
249 | 254 |
| |
250 |
| - | |
| 255 | + | |
| 256 | + | |
251 | 257 |
| |
252 | 258 |
| |
253 | 259 |
| |
| |||
384 | 390 |
| |
385 | 391 |
| |
386 | 392 |
| |
387 |
| - | |
388 |
| - | |
389 |
| - | |
390 |
| - | |
391 |
| - | |
392 |
| - | |
393 |
| - | |
394 |
| - | |
395 |
| - | |
396 |
| - | |
397 |
| - | |
398 |
| - | |
399 |
| - | |
400 |
| - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
401 | 396 |
| |
402 | 397 |
| |
403 | 398 |
| |
| |||
504 | 499 |
| |
505 | 500 |
| |
506 | 501 |
| |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
507 | 509 |
| |
508 | 510 |
| |
509 | 511 |
| |
| |||
563 | 565 |
| |
564 | 566 |
| |
565 | 567 |
| |
566 |
| - | |
| 568 | + | |
| 569 | + | |
567 | 570 |
| |
568 |
| - | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
569 | 574 |
| |
570 | 575 |
| |
571 | 576 |
| |
| |||
670 | 675 |
| |
671 | 676 |
| |
672 | 677 |
| |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
673 | 684 |
| |
674 | 685 |
|
0 commit comments
Comments
(0)