postgresql/src/include/utils
Andres Freund 623a9ba79b snapshot scalability: cache snapshots using a xact completion counter.
Previous commits made it faster/more scalable to compute snapshots. But not
building a snapshot is still faster. Now that GetSnapshotData() does not
maintain RecentGlobal* anymore, that is actually not too hard:

This commit introduces xactCompletionCount, which tracks the number of
top-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 current
xactCompletionCount is the same as it was when the snapshot was
originally built.  Currently this check happens while holding
ProcArrayLock. While it's likely possible to perform the check without
acquiring ProcArrayLock, it seems better to do that separately /
later, some careful analysis is required. Even with the lock this is a
significant win on its own.

On a smaller two socket machine this gains another ~1.03x, on a larger
machine the effect is roughly double (earlier patch version tested
though).  If we were able to safely avoid the lock there'd be another
significant 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.de
2020-08-17 21:08:30 -07:00
..
.gitignore Revert "Add gitignore entries for jsonpath_gram.h" 2019-03-23 00:19:34 +01:00
acl.h Unify drop-by-OID functions 2020-06-09 09:39:46 +02:00
aclchk_internal.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
array.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
arrayaccess.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
ascii.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
attoptcache.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
builtins.h Replace remaining StrNCpy() by strlcpy() 2020-08-10 23:20:37 +02:00
bytea.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
cash.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
catcache.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
combocid.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
date.h Reject "23:59:60.nnn" in datetime input. 2020-06-04 16:42:23 -04:00
datetime.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
datum.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
dsa.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
dynahash.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
elog.h Go back to returning int from ereport auxiliary functions. 2020-03-25 11:57:36 -04:00
evtcache.h Fix up recent breakage of headerscheck and cpluspluscheck. 2020-03-21 18:28:44 -04:00
expandeddatum.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
expandedrecord.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
float.h Make floating-point "NaN / 0" return NaN instead of raising an error. 2020-07-20 19:44:45 -04:00
fmgrtab.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
formatting.h Allow to_date/to_timestamp to recognize non-English month/day names. 2020-03-03 11:06:47 -05:00
freepage.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
geo_decls.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
guc.h Improve user control over truncation of logged bind-parameter values. 2020-04-02 15:04:51 -04:00
guc_tables.h code: replace 'master' with 'primary' where appropriate. 2020-07-08 12:57:23 -07:00
help_config.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
hsearch.h Put all the prototypes for hashfn.c into the same header file. 2020-02-24 17:22:45 +05:30
index_selfuncs.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
inet.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
int8.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
inval.h WAL Log invalidations at command end with wal_level=logical. 2020-07-23 08:34:48 +05:30
json.h Adjust src/include/utils/jsonapi.h so it's not backend-only. 2020-01-24 09:58:37 -08:00
jsonb.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jsonfuncs.h Fix some header identifications 2020-07-14 13:39:45 +09:00
jsonpath.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
logtape.h Introduce LogicalTapeSetExtend(). 2020-03-09 10:40:02 -07:00
lsyscache.h Improve ineq_histogram_selectivity's behavior for non-default orderings. 2020-06-05 16:55:27 -04:00
memdebug.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
memutils.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
numeric.h Support infinity and -infinity in the numeric data type. 2020-07-22 19:19:44 -04:00
palloc.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
partcache.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_crc.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_locale.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_lsn.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_rusage.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pidfile.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
plancache.h Add generic_plans and custom_plans fields into pg_prepared_statements. 2020-07-20 11:55:50 +09:00
portal.h Represent command completion tags as structs 2020-03-02 18:19:51 -03:00
ps_status.h Refactor ps_status.c API 2020-03-11 16:38:31 +01:00
queryenvironment.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
rangetypes.h Initial pgindent and pgperltidy run for v13. 2020-05-14 13:06:50 -04:00
regproc.h Eliminate cache lookup errors in SQL functions for object addresses 2020-07-15 09:03:10 +09:00
rel.h Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
relcache.h Skip WAL for new relfilenodes, under wal_level=minimal. 2020-04-04 12:25:34 -07:00
relfilenodemap.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
relmapper.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
relptr.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
reltrigger.h Enable BEFORE row-level triggers for partitioned tables 2020-03-18 18:58:05 -03:00
resowner.h Improve performance of "simple expressions" in PL/pgSQL. 2020-03-26 18:58:57 -04:00
resowner_private.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
rls.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
ruleutils.h Implement operator class parameters 2020-03-30 19:17:23 +03:00
sampling.h Report progress of ANALYZE commands 2020-01-15 11:14:39 -03:00
selfuncs.h Improve ineq_histogram_selectivity's behavior for non-default orderings. 2020-06-05 16:55:27 -04:00
sharedtuplestore.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
snapmgr.h snapshot scalability: Don't compute global horizons while building snapshots. 2020-08-12 16:03:49 -07:00
snapshot.h snapshot scalability: cache snapshots using a xact completion counter. 2020-08-17 21:08:30 -07:00
sortsupport.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
spccache.h Introduce a maintenance_io_concurrency setting. 2020-03-16 17:14:26 +13:00
syscache.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
timeout.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
timestamp.h Revert 0f5ca02f53 2020-04-08 11:37:27 +03:00
tuplesort.h Use int64 instead of long in incremental sort code 2020-08-02 14:24:46 +12:00
tuplestore.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
typcache.h Allow ALTER TYPE to change some properties of a base type. 2020-03-06 12:19:29 -05:00
tzparser.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
uuid.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
varbit.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
varlena.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
xid8.h Add SQL type xid8 to expose FullTransactionId to users. 2020-04-07 12:03:59 +12:00
xml.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00