postgresql/src
Tom Lane 4460964aed 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:36 -04:00
..
backend Avoid holding AutovacuumScheduleLock while rechecking table statistics. 2018-03-13 12:28:36 -04:00
bin In initdb, don't bother trying max_connections = 10. 2018-03-08 11:26:43 -05:00
common Update copyright in recently added files 2017-07-26 18:17:18 -04:00
fe_utils Empty search_path in Autovacuum and non-psql/pgbench clients. 2018-02-26 07:39:47 -08:00
include Fix improper uses of canonicalize_qual(). 2018-03-11 18:10:42 -04:00
interfaces Set connection back to NULL after freeing it. 2018-03-13 16:23:25 +01:00
makefiles Always use -fPIC, not -fpic, when building shared libraries with gcc. 2017-06-01 13:32:55 -04:00
pl Translation updates 2018-02-26 08:28:54 -05:00
port Stamp 10.3. 2018-02-26 17:10:47 -05:00
template Remove "sco" and "unixware" ports. 2016-10-11 11:26:04 -04:00
test Fix CREATE TABLE / LIKE with bigint identity column 2018-03-13 09:41:36 -04:00
timezone Update time zone data files to tzdata release 2018c. 2018-01-27 16:42:36 -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 Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02: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 Build src/test/isolation during "make" and "make install". 2017-11-22 20:18:52 -08:00
Makefile.global.in Be more thorough about cleaning out gcov litter. 2017-08-11 17:39:27 -04:00
Makefile.shlib Remove support for bcc and msvc standalone libpq builds 2017-04-11 15:22:21 +02:00
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00