postgresql/src
Tom Lane 5328b61357 Avoid holding AutovacuumScheduleLock while rechecking table statistics.
In databases with many tables, re-fetching the statistics takes some time,
so that this behavior seriously decreases the available concurrency for
multiple autovac workers.  There's discussion afoot about more complete
fixes, but a simple and back-patchable amelioration is to claim the table
and release the lock before rechecking stats.  If we find out there's no
longer a reason to process the table, re-taking the lock to un-claim the
table is cheap enough.

(This patch is quite old, but got lost amongst a discussion of more
aggressive fixes.  It's not clear when or if such a fix will be
accepted, but in any case it'd be unlikely to get back-patched.
Let's do this now so we have some improvement for the back branches.)

In passing, make the normal un-claim step take AutovacuumScheduleLock
not AutovacuumLock, since that is what is documented to protect the
wi_tableoid field.  This wasn't an actual bug in view of the fact that
readers of that field hold both locks, but it creates some concurrency
penalty against operations that need only AutovacuumLock.

Back-patch to all supported versions.

Jeff Janes

Discussion: https://postgr.es/m/26118.1520865816@sss.pgh.pa.us
2018-03-13 12:28:40 -04:00
..
backend Avoid holding AutovacuumScheduleLock while rechecking table statistics. 2018-03-13 12:28:40 -04:00
bin Revert restructuring of bin/scripts/Makefile 2018-02-27 14:11:29 +01:00
common Unlink static libraries before rebuilding them. 2015-03-01 13:06:39 -05:00
include Fix improper uses of canonicalize_qual(). 2018-03-11 18:10:43 -04:00
interfaces Set connection back to NULL after freeing it. 2018-03-12 23:54:29 +01:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:56 -04:00
pl Translation updates 2018-02-26 08:38:58 -05:00
port Stamp 9.3.22. 2018-02-26 17:19:52 -05:00
template AIX: Test the -qlonglong option before use. 2015-07-17 03:02:03 -04:00
test Fix improper uses of canonicalize_qual(). 2018-03-11 18:10:43 -04:00
timezone Update time zone data files to tzdata release 2018c. 2018-01-27 16:43:00 -05:00
tools Fix up ecpg's configuration so it handles "long long int" in MSVC builds. 2018-02-27 16:46:52 -05:00
tutorial Remove tabs after spaces in C comments 2014-05-06 11:26:28 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
bcc32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
DEVELOPERS Replace a couple of references to files that no longer exist in the source 2009-05-04 08:08:47 +00:00
Makefile Create libpgcommon, and move pg_malloc et al to it 2013-02-12 11:21:05 -03:00
Makefile.global.in PL/Perl portability fix: absorb relevant -D switches from Perl. 2017-07-31 12:38:35 -04:00
Makefile.shlib Fix typos in comments. 2017-02-06 11:34:28 +02:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00