- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit0e69f70
committed
Set pg_class.reltuples for partitioned tables
When commit0827e8a added auto-analyze support for partitionedtables, it included code to obtain reltuples for the partitioned tableas a number of catalog accesses to read pg_class.reltuples for eachpartition. That's not only very inefficient, but also problematicbecause autovacuum doesn't hold any locks on any of those tables -- anddoesn't want to. Replace that code with a read of pg_class.reltuplesfor the partitioned table, and make sure ANALYZE and TRUNCATE properlymaintain that value.I found no code that would be affected by the change of relpages fromzero to non-zero for partitioned tables, and no other code that shouldbe maintaining it, but if there is, hopefully it'll be an easy fix.Per buildfarm.Author: Álvaro Herrera <alvherre@alvh.no-ip.org>Reviewed-by: Zhihong Yu <zyu@yugabyte.com>Discussion:https://postgr.es/m/1823909.1617862590@sss.pgh.pa.us1 parent1798d8f commit0e69f70
File tree
3 files changed
+59
-39
lines changed- src/backend
- commands
- postmaster
3 files changed
+59
-39
lines changedLines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
656 | 656 |
| |
657 | 657 |
| |
658 | 658 |
| |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
659 | 671 |
| |
660 | 672 |
| |
661 | 673 |
| |
|
Lines changed: 46 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
337 | 337 |
| |
338 | 338 |
| |
339 | 339 |
| |
| 340 | + | |
340 | 341 |
| |
341 | 342 |
| |
342 | 343 |
| |
| |||
1755 | 1756 |
| |
1756 | 1757 |
| |
1757 | 1758 |
| |
| 1759 | + | |
1758 | 1760 |
| |
1759 | 1761 |
| |
1760 | 1762 |
| |
| |||
1908 | 1910 |
| |
1909 | 1911 |
| |
1910 | 1912 |
| |
1911 |
| - | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
1912 | 1917 |
| |
| 1918 | + | |
| 1919 | + | |
1913 | 1920 |
| |
| 1921 | + | |
1914 | 1922 |
| |
1915 | 1923 |
| |
1916 | 1924 |
| |
| |||
2061 | 2069 |
| |
2062 | 2070 |
| |
2063 | 2071 |
| |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
2064 | 2075 |
| |
2065 | 2076 |
| |
2066 | 2077 |
| |
| |||
2207 | 2218 |
| |
2208 | 2219 |
| |
2209 | 2220 |
| |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
2210 | 2255 |
| |
2211 | 2256 |
| |
2212 | 2257 |
| |
|
Lines changed: 1 addition & 38 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3209 | 3209 |
| |
3210 | 3210 |
| |
3211 | 3211 |
| |
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 |
| - | |
| 3212 | + | |
3250 | 3213 |
| |
3251 | 3214 |
| |
3252 | 3215 |
| |
|
0 commit comments
Comments
(0)