Replace explicit PIN entries in pg_depend with an OID range test.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 15 Jul 2021 15:41:47 +0000 (11:41 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 15 Jul 2021 15:41:47 +0000 (11:41 -0400)
commita49d081235997c67e8aab7a523b17e8d1cb93184
tree4bf81347757488fc1ab5c651dc4f3ab0eb1b8a87
parente529b2dc37ac80ccebd76cdbb14966d3b40819c9
Replace explicit PIN entries in pg_depend with an OID range test.

As of v14, pg_depend contains almost 7000 "pin" entries recording
the OIDs of built-in objects.  This is a fair amount of bloat for
every database, and it adds time to pg_depend lookups as well as
initdb.  We can get rid of all of those entries in favor of an OID
range check, i.e. "OIDs below FirstUnpinnedObjectId are pinned".

(template1 and the public schema are exceptions.  Those exceptions
are now wired into IsPinnedObject() instead of initdb's code for
filling pg_depend, but it's the same amount of cruft either way.)

The contents of pg_shdepend are modified likewise.

Discussion: https://postgr.es/m/3737988.1618451008@sss.pgh.pa.us
25 files changed:
doc/src/sgml/bki.sgml
doc/src/sgml/catalogs.sgml
src/backend/access/transam/varsup.c
src/backend/access/transam/xlog.c
src/backend/catalog/catalog.c
src/backend/catalog/dependency.c
src/backend/catalog/genbki.pl
src/backend/catalog/pg_depend.c
src/backend/catalog/pg_publication.c
src/backend/catalog/pg_shdepend.c
src/backend/commands/tablecmds.c
src/backend/commands/tablespace.c
src/backend/optimizer/plan/setrefs.c
src/backend/storage/lmgr/predicate.c
src/bin/initdb/initdb.c
src/bin/pg_resetwal/pg_resetwal.c
src/include/access/transam.h
src/include/catalog/catalog.h
src/include/catalog/catversion.h
src/include/catalog/dependency.h
src/include/catalog/pg_depend.h
src/include/catalog/pg_proc.dat
src/include/catalog/pg_shdepend.h
src/test/regress/expected/misc_sanity.out
src/test/regress/sql/misc_sanity.sql