forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit623a9ba
committed
snapshot scalability: cache snapshots using a xact completion counter.
Previous commits made it faster/more scalable to compute snapshots. But notbuilding a snapshot is still faster. Now that GetSnapshotData() does notmaintain RecentGlobal* anymore, that is actually not too hard:This commit introduces xactCompletionCount, which tracks the number oftop-level transactions with xids (i.e. which may have modified the database)that completed in some form since the start of the server.We can avoid rebuilding the snapshot's contents whenever the currentxactCompletionCount is the same as it was when the snapshot wasoriginally built. Currently this check happens while holdingProcArrayLock. While it's likely possible to perform the check withoutacquiring ProcArrayLock, it seems better to do that separately /later, some careful analysis is required. Even with the lock this is asignificant win on its own.On a smaller two socket machine this gains another ~1.03x, on a largermachine the effect is roughly double (earlier patch version testedthough). If we were able to safely avoid the lock there'd be anothersignificant gain on top of that.Author: Andres Freund <andres@anarazel.de>Reviewed-By: Robert Haas <robertmhaas@gmail.com>Reviewed-By: Thomas Munro <thomas.munro@gmail.com>Reviewed-By: David Rowley <dgrowleyml@gmail.com>Discussion:https://postgr.es/m/20200301083601.ews6hz5dduc3w2se@alap3.anarazel.de1 parent51300b4 commit623a9ba
File tree
5 files changed
+126
-20
lines changed- src
- backend
- replication/logical
- storage/ipc
- utils/time
- include
- access
- utils
5 files changed
+126
-20
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
524 | 524 |
| |
525 | 525 |
| |
526 | 526 |
| |
| 527 | + | |
527 | 528 |
| |
528 | 529 |
| |
529 | 530 |
| |
|
Lines changed: 105 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
407 | 407 |
| |
408 | 408 |
| |
409 | 409 |
| |
| 410 | + | |
410 | 411 |
| |
411 | 412 |
| |
412 | 413 |
| |
| |||
534 | 535 |
| |
535 | 536 |
| |
536 | 537 |
| |
| 538 | + | |
| 539 | + | |
| 540 | + | |
537 | 541 |
| |
538 | 542 |
| |
539 | 543 |
| |
| |||
667 | 671 |
| |
668 | 672 |
| |
669 | 673 |
| |
| 674 | + | |
670 | 675 |
| |
671 | 676 |
| |
672 | 677 |
| |
| |||
698 | 703 |
| |
699 | 704 |
| |
700 | 705 |
| |
| 706 | + | |
| 707 | + | |
| 708 | + | |
701 | 709 |
| |
702 | 710 |
| |
703 | 711 |
| |
| |||
1916 | 1924 |
| |
1917 | 1925 |
| |
1918 | 1926 |
| |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
| 1991 | + | |
| 1992 | + | |
| 1993 | + | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
| 1998 | + | |
| 1999 | + | |
| 2000 | + | |
| 2001 | + | |
| 2002 | + | |
| 2003 | + | |
| 2004 | + | |
| 2005 | + | |
| 2006 | + | |
| 2007 | + | |
| 2008 | + | |
| 2009 | + | |
| 2010 | + | |
| 2011 | + | |
| 2012 | + | |
| 2013 | + | |
1919 | 2014 |
| |
1920 | 2015 |
| |
1921 | 2016 |
| |
| |||
1963 | 2058 |
| |
1964 | 2059 |
| |
1965 | 2060 |
| |
| 2061 | + | |
1966 | 2062 |
| |
1967 | 2063 |
| |
1968 | 2064 |
| |
| |||
2007 | 2103 |
| |
2008 | 2104 |
| |
2009 | 2105 |
| |
| 2106 | + | |
| 2107 | + | |
| 2108 | + | |
| 2109 | + | |
| 2110 | + | |
| 2111 | + | |
2010 | 2112 |
| |
2011 | 2113 |
| |
2012 | 2114 |
| |
2013 | 2115 |
| |
2014 | 2116 |
| |
2015 | 2117 |
| |
| 2118 | + | |
2016 | 2119 |
| |
2017 | 2120 |
| |
2018 | 2121 |
| |
| |||
2266 | 2369 |
| |
2267 | 2370 |
| |
2268 | 2371 |
| |
| 2372 | + | |
2269 | 2373 |
| |
2270 | 2374 |
| |
2271 | 2375 |
| |
| |||
2277 | 2381 |
| |
2278 | 2382 |
| |
2279 | 2383 |
| |
2280 |
| - | |
2281 |
| - | |
2282 |
| - | |
2283 |
| - | |
2284 |
| - | |
2285 |
| - | |
2286 |
| - | |
2287 |
| - | |
2288 |
| - | |
2289 |
| - | |
2290 |
| - | |
2291 |
| - | |
2292 |
| - | |
2293 |
| - | |
2294 |
| - | |
2295 |
| - | |
2296 |
| - | |
2297 |
| - | |
2298 |
| - | |
2299 |
| - | |
| 2384 | + | |
2300 | 2385 |
| |
2301 | 2386 |
| |
2302 | 2387 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
597 | 597 |
| |
598 | 598 |
| |
599 | 599 |
| |
| 600 | + | |
| 601 | + | |
600 | 602 |
| |
601 | 603 |
| |
602 | 604 |
| |
| |||
672 | 674 |
| |
673 | 675 |
| |
674 | 676 |
| |
| 677 | + | |
675 | 678 |
| |
676 | 679 |
| |
677 | 680 |
| |
| |||
2209 | 2212 |
| |
2210 | 2213 |
| |
2211 | 2214 |
| |
| 2215 | + | |
2212 | 2216 |
| |
2213 | 2217 |
| |
2214 | 2218 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
231 | 231 |
| |
232 | 232 |
| |
233 | 233 |
| |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
234 | 243 |
| |
235 | 244 |
| |
236 | 245 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
207 | 207 |
| |
208 | 208 |
| |
209 | 209 |
| |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
210 | 217 |
| |
211 | 218 |
| |
212 | 219 |
|
0 commit comments
Comments
(0)