- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit9f3665f
committed
Don't consider newly inserted tuples in nbtree VACUUM.
Remove the entire idea of "stale stats" within nbtree VACUUM (stopcaring about stats involving the number of inserted tuples). Alsoremove the vacuum_cleanup_index_scale_factor GUC/param on the masterbranch (though just disable them on postgres 13).The vacuum_cleanup_index_scale_factor/stats interface made the nbtree AMpartially responsible for deciding when pg_class.reltuples stats neededto be updated. This seems contrary to the spirit of the index AM API,though -- it is not actually necessary for an index AM's bulk delete andcleanup callbacks to provide accurate stats when it happens to beinconvenient. The core code owns that. (Index AMs have the authorityto perform or not perform certain kinds of deferred cleanup based ontheir own considerations, such as page deletion and recycling, but thathas little to do with pg_class.reltuples/num_index_tuples.)This issue was fairly harmless until the introduction of theautovacuum_vacuum_insert_threshold feature by commitb07642d, which hadan undesirable interaction with the vacuum_cleanup_index_scale_factormechanism: it made insert-driven autovacuums perform full index scans,even though there is no real benefit to doing so. This has been tied toa regression with an append-only insert benchmark [1].Also have remaining cases that perform a full scan of an index during acleanup-only nbtree VACUUM indicate that the final tuple count is onlyan estimate. This prevents vacuumlazy.c from setting the index'spg_class.reltuples in those cases (it will now only update pg_class whenvacuumlazy.c had TIDs for nbtree to bulk delete). This arguably fixesan oversight in deduplication-related bugfix commit48e1291.[1]https://smalldatum.blogspot.com/2021/01/insert-benchmark-postgres-is-still.htmlAuthor: Peter Geoghegan <pg@bowt.ie>Reviewed-By: Masahiko Sawada <sawada.mshk@gmail.com>Discussion:https://postgr.es/m/CAD21AoA4WHthN5uU6+WScZ7+J_RcEjmcuH94qcoUPuB42ShXzg@mail.gmail.comBackpatch: 13-, where autovacuum_vacuum_insert_threshold was added.1 parent845ac7f commit9f3665f
File tree
19 files changed
+42
-222
lines changed- doc/src/sgml
- ref
- src
- backend
- access
- common
- nbtree
- rmgrdesc
- utils
- init
- misc
- bin/psql
- include
- access
- test/regress
- expected
- sql
19 files changed
+42
-222
lines changedLines changed: 0 additions & 40 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8544 | 8544 |
| |
8545 | 8545 |
| |
8546 | 8546 |
| |
8547 |
| - | |
8548 |
| - | |
8549 |
| - | |
8550 |
| - | |
8551 |
| - | |
8552 |
| - | |
8553 |
| - | |
8554 |
| - | |
8555 |
| - | |
8556 |
| - | |
8557 |
| - | |
8558 |
| - | |
8559 |
| - | |
8560 |
| - | |
8561 |
| - | |
8562 |
| - | |
8563 |
| - | |
8564 |
| - | |
8565 |
| - | |
8566 |
| - | |
8567 |
| - | |
8568 |
| - | |
8569 |
| - | |
8570 |
| - | |
8571 |
| - | |
8572 |
| - | |
8573 |
| - | |
8574 |
| - | |
8575 |
| - | |
8576 |
| - | |
8577 |
| - | |
8578 |
| - | |
8579 |
| - | |
8580 |
| - | |
8581 |
| - | |
8582 |
| - | |
8583 |
| - | |
8584 |
| - | |
8585 |
| - | |
8586 |
| - | |
8587 | 8547 |
| |
8588 | 8548 |
| |
8589 | 8549 |
| |
|
Lines changed: 0 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
456 | 456 |
| |
457 | 457 |
| |
458 | 458 |
| |
459 |
| - | |
460 |
| - | |
461 |
| - | |
462 |
| - | |
463 |
| - | |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 |
| - | |
468 |
| - | |
469 |
| - | |
470 |
| - | |
471 |
| - | |
472 |
| - | |
473 | 459 |
| |
474 | 460 |
| |
475 | 461 |
| |
|
Lines changed: 0 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
461 | 461 |
| |
462 | 462 |
| |
463 | 463 |
| |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 |
| - | |
468 |
| - | |
469 |
| - | |
470 |
| - | |
471 |
| - | |
472 |
| - | |
473 | 464 |
| |
474 | 465 |
| |
475 | 466 |
| |
|
Lines changed: 0 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1332 | 1332 |
| |
1333 | 1333 |
| |
1334 | 1334 |
| |
1335 |
| - | |
1336 |
| - | |
1337 | 1335 |
| |
1338 | 1336 |
| |
1339 | 1337 |
| |
| |||
2549 | 2547 |
| |
2550 | 2548 |
| |
2551 | 2549 |
| |
2552 |
| - | |
2553 | 2550 |
| |
2554 | 2551 |
| |
2555 | 2552 |
| |
|
Lines changed: 13 additions & 27 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
175 | 175 |
| |
176 | 176 |
| |
177 | 177 |
| |
178 |
| - | |
179 |
| - | |
180 |
| - | |
181 |
| - | |
182 |
| - | |
183 |
| - | |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
| 178 | + | |
| 179 | + | |
188 | 180 |
| |
189 | 181 |
| |
190 |
| - | |
191 |
| - | |
| 182 | + | |
192 | 183 |
| |
193 | 184 |
| |
194 | 185 |
| |
195 | 186 |
| |
196 |
| - | |
197 |
| - | |
198 | 187 |
| |
199 | 188 |
| |
200 | 189 |
| |
| |||
209 | 198 |
| |
210 | 199 |
| |
211 | 200 |
| |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
212 | 205 |
| |
213 | 206 |
| |
214 | 207 |
| |
215 | 208 |
| |
216 | 209 |
| |
217 |
| - | |
218 |
| - | |
219 |
| - | |
220 |
| - | |
221 |
| - | |
222 |
| - | |
223 |
| - | |
224 |
| - | |
225 |
| - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
226 | 213 |
| |
| 214 | + | |
227 | 215 |
| |
228 | 216 |
| |
229 | 217 |
| |
| |||
240 | 228 |
| |
241 | 229 |
| |
242 | 230 |
| |
243 |
| - | |
| 231 | + | |
244 | 232 |
| |
245 | 233 |
| |
246 | 234 |
| |
247 | 235 |
| |
248 | 236 |
| |
249 | 237 |
| |
| 238 | + | |
250 | 239 |
| |
251 | 240 |
| |
252 | 241 |
| |
| |||
258 | 247 |
| |
259 | 248 |
| |
260 | 249 |
| |
261 |
| - | |
262 | 250 |
| |
263 | 251 |
| |
264 | 252 |
| |
| |||
443 | 431 |
| |
444 | 432 |
| |
445 | 433 |
| |
446 |
| - | |
447 | 434 |
| |
448 | 435 |
| |
449 | 436 |
| |
| |||
2632 | 2619 |
| |
2633 | 2620 |
| |
2634 | 2621 |
| |
2635 |
| - | |
2636 | 2622 |
| |
2637 | 2623 |
| |
2638 | 2624 |
| |
|
Lines changed: 21 additions & 49 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
789 | 789 |
| |
790 | 790 |
| |
791 | 791 |
| |
792 |
| - | |
793 |
| - | |
794 | 792 |
| |
795 | 793 |
| |
796 |
| - | |
797 | 794 |
| |
798 | 795 |
| |
799 | 796 |
| |
| |||
816 | 813 |
| |
817 | 814 |
| |
818 | 815 |
| |
819 |
| - | |
820 | 816 |
| |
821 | 817 |
| |
822 |
| - | |
823 |
| - | |
824 |
| - | |
825 |
| - | |
826 |
| - | |
827 |
| - | |
828 |
| - | |
829 |
| - | |
830 |
| - | |
831 |
| - | |
832 |
| - | |
833 |
| - | |
834 |
| - | |
835 |
| - | |
836 |
| - | |
837 |
| - | |
838 |
| - | |
839 |
| - | |
840 |
| - | |
841 |
| - | |
842 |
| - | |
843 |
| - | |
844 |
| - | |
845 | 818 |
| |
846 | 819 |
| |
847 | 820 |
| |
| |||
925 | 898 |
| |
926 | 899 |
| |
927 | 900 |
| |
928 |
| - | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
929 | 912 |
| |
930 | 913 |
| |
931 | 914 |
| |
| 915 | + | |
932 | 916 |
| |
933 | 917 |
| |
934 | 918 |
| |
935 | 919 |
| |
936 |
| - | |
937 |
| - | |
| 920 | + | |
938 | 921 |
| |
939 | 922 |
| |
940 | 923 |
| |
941 | 924 |
| |
942 | 925 |
| |
943 | 926 |
| |
944 |
| - | |
945 |
| - | |
946 |
| - | |
947 |
| - | |
948 |
| - | |
949 |
| - | |
950 |
| - | |
951 |
| - | |
952 |
| - | |
953 |
| - | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
954 | 930 |
| |
955 | 931 |
| |
956 | 932 |
| |
957 |
| - | |
| 933 | + | |
958 | 934 |
| |
959 | 935 |
| |
960 | 936 |
| |
961 | 937 |
| |
962 | 938 |
| |
963 | 939 |
| |
964 |
| - | |
965 |
| - | |
966 |
| - | |
967 |
| - | |
968 |
| - | |
969 |
| - | |
970 | 940 |
| |
971 | 941 |
| |
972 | 942 |
| |
| |||
1016 | 986 |
| |
1017 | 987 |
| |
1018 | 988 |
| |
1019 |
| - | |
1020 | 989 |
| |
1021 | 990 |
| |
1022 | 991 |
| |
| |||
1421 | 1390 |
| |
1422 | 1391 |
| |
1423 | 1392 |
| |
1424 |
| - | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
1425 | 1397 |
| |
1426 | 1398 |
| |
1427 | 1399 |
| |
|
Lines changed: 0 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2105 | 2105 |
| |
2106 | 2106 |
| |
2107 | 2107 |
| |
2108 |
| - | |
2109 |
| - | |
2110 | 2108 |
| |
2111 | 2109 |
| |
2112 | 2110 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
113 | 113 |
| |
114 | 114 |
| |
115 | 115 |
| |
116 |
| - | |
| 116 | + | |
117 | 117 |
| |
118 | 118 |
| |
119 | 119 |
| |
|
Lines changed: 2 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
113 | 113 |
| |
114 | 114 |
| |
115 | 115 |
| |
116 |
| - | |
117 |
| - | |
118 |
| - | |
| 116 | + | |
| 117 | + | |
119 | 118 |
| |
120 | 119 |
| |
121 | 120 |
| |
|
Lines changed: 0 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
148 | 148 |
| |
149 | 149 |
| |
150 | 150 |
| |
151 |
| - | |
152 |
| - |
Lines changed: 0 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3703 | 3703 |
| |
3704 | 3704 |
| |
3705 | 3705 |
| |
3706 |
| - | |
3707 |
| - | |
3708 |
| - | |
3709 |
| - | |
3710 |
| - | |
3711 |
| - | |
3712 |
| - | |
3713 |
| - | |
3714 |
| - | |
3715 |
| - | |
3716 | 3706 |
| |
3717 | 3707 |
| |
3718 | 3708 |
| |
|
Lines changed: 0 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
672 | 672 |
| |
673 | 673 |
| |
674 | 674 |
| |
675 |
| - | |
676 |
| - | |
677 |
| - | |
678 | 675 |
| |
679 | 676 |
| |
680 | 677 |
| |
|
0 commit comments
Comments
(0)