Commit 0827e8a
committed
autovacuum: handle analyze for partitioned tables
Previously, autovacuum would completely ignore partitioned tables, which
is not good regarding analyze -- failing to analyze those tables means
poor plans may be chosen. Make autovacuum aware of those tables by
propagating "changes since analyze" counts from the leaf partitions up
the partitioning hierarchy.
This also introduces necessary reloptions support for partitioned tables
(autovacuum_enabled, autovacuum_analyze_scale_factor,
autovacuum_analyze_threshold). It's unclear how best to document this
aspect.
Author: Yuzuko Hosoya <yuzukohosoya@gmail.com>
Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Reviewed-by: Tomas Vondra <tomas.vondra@enterprisedb.com>
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/CAKkQ508_PwVgwJyBY=0Lmkz90j8CmWNPUxgHvCUwGhMrouz6UA@mail.gmail.com1 parent b3ee4c5 commit 0827e8aCopy full SHA for 0827e8a
File tree
Expand file treeCollapse file tree
7 files changed
+257
-44
lines changedOpen diff view settings
Filter options
- src
- backend
- access/common
- catalog
- commands
- postmaster
- include
- test/regress/expected
Expand file treeCollapse file tree
7 files changed
+257
-44
lines changedOpen diff view settings
Collapse file
src/backend/access/common/reloptions.c
Copy file name to clipboardExpand all lines: src/backend/access/common/reloptions.c+7-8Lines changed: 7 additions & 8 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
108 | 108 | |
109 | 109 | |
110 | 110 | |
111 | | - |
| 111 | + |
112 | 112 | |
113 | 113 | |
114 | 114 | |
| ||
246 | 246 | |
247 | 247 | |
248 | 248 | |
249 | | - |
| 249 | + |
250 | 250 | |
251 | 251 | |
252 | 252 | |
| ||
420 | 420 | |
421 | 421 | |
422 | 422 | |
423 | | - |
| 423 | + |
424 | 424 | |
425 | 425 | |
426 | 426 | |
| ||
1962 | 1962 | |
1963 | 1963 | |
1964 | 1964 | |
1965 | | - |
1966 | | - |
| 1965 | + |
| 1966 | + |
1967 | 1967 | |
1968 | | - |
1969 | | - |
1970 | | - |
| 1968 | + |
| 1969 | + |
1971 | 1970 | |
1972 | 1971 | |
1973 | 1972 | |
|
Collapse file
src/backend/catalog/system_views.sql
Copy file name to clipboardExpand all lines: src/backend/catalog/system_views.sql+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
660 | 660 | |
661 | 661 | |
662 | 662 | |
663 | | - |
| 663 | + |
664 | 664 | |
665 | 665 | |
666 | 666 | |
| ||
680 | 680 | |
681 | 681 | |
682 | 682 | |
683 | | - |
| 683 | + |
684 | 684 | |
685 | 685 | |
686 | 686 | |
|
Collapse file
src/backend/commands/analyze.c
Copy file name to clipboardExpand all lines: src/backend/commands/analyze.c+28-12Lines changed: 28 additions & 12 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
612 | 612 | |
613 | 613 | |
614 | 614 | |
615 | | - |
616 | | - |
| 615 | + |
| 616 | + |
617 | 617 | |
618 | 618 | |
619 | 619 | |
| ||
655 | 655 | |
656 | 656 | |
657 | 657 | |
| 658 | + |
658 | 659 | |
659 | | - |
660 | | - |
661 | | - |
662 | | - |
663 | | - |
664 | | - |
665 | | - |
666 | | - |
667 | | - |
668 | | - |
| 660 | + |
| 661 | + |
| 662 | + |
| 663 | + |
| 664 | + |
| 665 | + |
| 666 | + |
| 667 | + |
| 668 | + |
| 669 | + |
669 | 670 | |
670 | 671 | |
| 672 | + |
| 673 | + |
| 674 | + |
| 675 | + |
| 676 | + |
| 677 | + |
| 678 | + |
| 679 | + |
| 680 | + |
| 681 | + |
| 682 | + |
| 683 | + |
| 684 | + |
| 685 | + |
| 686 | + |
671 | 687 | |
672 | 688 | |
673 | 689 | |
|
Collapse file
src/backend/postmaster/autovacuum.c
Copy file name to clipboardExpand all lines: src/backend/postmaster/autovacuum.c+95-10Lines changed: 95 additions & 10 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
75 | 75 | |
76 | 76 | |
77 | 77 | |
| 78 | + |
78 | 79 | |
79 | 80 | |
80 | 81 | |
| ||
1969 | 1970 | |
1970 | 1971 | |
1971 | 1972 | |
| 1973 | + |
1972 | 1974 | |
1973 | 1975 | |
1974 | 1976 | |
| ||
2054 | 2056 | |
2055 | 2057 | |
2056 | 2058 | |
2057 | | - |
2058 | | - |
2059 | | - |
2060 | | - |
2061 | | - |
2062 | | - |
| 2059 | + |
| 2060 | + |
| 2061 | + |
| 2062 | + |
| 2063 | + |
| 2064 | + |
| 2065 | + |
| 2066 | + |
| 2067 | + |
| 2068 | + |
| 2069 | + |
| 2070 | + |
| 2071 | + |
2063 | 2072 | |
2064 | 2073 | |
2065 | 2074 | |
| ||
2068 | 2077 | |
2069 | 2078 | |
2070 | 2079 | |
2071 | | - |
| 2080 | + |
| 2081 | + |
| 2082 | + |
| 2083 | + |
| 2084 | + |
| 2085 | + |
| 2086 | + |
| 2087 | + |
| 2088 | + |
| 2089 | + |
| 2090 | + |
| 2091 | + |
| 2092 | + |
| 2093 | + |
| 2094 | + |
| 2095 | + |
| 2096 | + |
| 2097 | + |
| 2098 | + |
| 2099 | + |
| 2100 | + |
| 2101 | + |
| 2102 | + |
| 2103 | + |
| 2104 | + |
| 2105 | + |
| 2106 | + |
| 2107 | + |
| 2108 | + |
| 2109 | + |
| 2110 | + |
| 2111 | + |
| 2112 | + |
| 2113 | + |
| 2114 | + |
| 2115 | + |
| 2116 | + |
| 2117 | + |
2072 | 2118 | |
2073 | 2119 | |
2074 | 2120 | |
| ||
2082 | 2128 | |
2083 | 2129 | |
2084 | 2130 | |
2085 | | - |
| 2131 | + |
| 2132 | + |
2086 | 2133 | |
2087 | 2134 | |
2088 | 2135 | |
| ||
2157 | 2204 | |
2158 | 2205 | |
2159 | 2206 | |
2160 | | - |
| 2207 | + |
2161 | 2208 | |
2162 | 2209 | |
2163 | 2210 | |
| ||
2745 | 2792 | |
2746 | 2793 | |
2747 | 2794 | |
| 2795 | + |
2748 | 2796 | |
2749 | 2797 | |
2750 | 2798 | |
| ||
3161 | 3209 | |
3162 | 3210 | |
3163 | 3211 | |
3164 | | - |
| 3212 | + |
| 3213 | + |
| 3214 | + |
| 3215 | + |
| 3216 | + |
| 3217 | + |
| 3218 | + |
| 3219 | + |
| 3220 | + |
| 3221 | + |
| 3222 | + |
| 3223 | + |
| 3224 | + |
| 3225 | + |
| 3226 | + |
| 3227 | + |
| 3228 | + |
| 3229 | + |
| 3230 | + |
| 3231 | + |
| 3232 | + |
| 3233 | + |
| 3234 | + |
| 3235 | + |
| 3236 | + |
| 3237 | + |
| 3238 | + |
| 3239 | + |
| 3240 | + |
| 3241 | + |
| 3242 | + |
| 3243 | + |
| 3244 | + |
| 3245 | + |
| 3246 | + |
| 3247 | + |
| 3248 | + |
| 3249 | + |
3165 | 3250 | |
3166 | 3251 | |
3167 | 3252 | |
|
0 commit comments