postgresql/src
Tom Lane 38f7831d70 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:35 -04:00
..
backend Avoid holding AutovacuumScheduleLock while rechecking table statistics. 2018-03-13 12:28:35 -04:00
bin Clarify initdb --help message for --wal-segsize 2018-03-11 14:12:36 +01:00
common Move strtoint() to common 2018-03-13 10:21:09 -04:00
fe_utils
include Move strtoint() to common 2018-03-13 10:21:09 -04:00
interfaces Set connection back to NULL after freeing it. 2018-03-13 16:22:28 +01:00
makefiles
pl Remove some obsolete procedure-specific code from PLs 2018-03-05 11:51:15 -05:00
port Add an assertion that we don't pass NULL to snprintf("%s"). 2018-02-14 15:06:01 -05:00
template
test Fix CREATE TABLE / LIKE with bigint identity column 2018-03-13 09:41:30 -04:00
timezone
tools Actually pick .lib file when multiple perl libs are present 2018-03-04 18:01:25 +01:00
tutorial
.gitignore
DEVELOPERS
Makefile
Makefile.global.in Tests for Kerberos/GSSAPI authentication 2018-03-06 10:57:36 -05:00
Makefile.shlib
nls-global.mk nls-global.mk: search build dir for source files, too 2016-06-07 18:55:18 -04:00