postgresql/src
Kevin Grittner a7516bbc49 Fix an O(N^2) problem in foreign key references.
Commit 45ba424f improved foreign key lookups during bulk updates
when the FK value does not change.  When restoring a schema dump
from a database with many (say 100,000) foreign keys, this cache
would grow very big and every ALTER TABLE command was causing an
InvalidateConstraintCacheCallBack(), which uses a sequential hash
table scan.  This could cause a severe performance regression in
restoring a schema dump (including during pg_upgrade).

The patch uses a heuristic method of detecting when the hash table
should be destroyed and recreated.
InvalidateConstraintCacheCallBack() adds the current size of the
hash table to a counter.  When that sum reaches 1,000,000, the hash
table is flushed.  This fixes the regression without noticeable
harm to the bulk update use case.

Jan Wieck
Backpatch to 9.3 where the performance regression was introduced.
2015-09-11 13:20:49 -05:00
..
backend Fix an O(N^2) problem in foreign key references. 2015-09-11 13:20:49 -05:00
bin psql: print longtable as a possible \pset option 2015-08-31 12:24:16 -04:00
common Unlink static libraries before rebuilding them. 2015-03-01 13:06:39 -05:00
include Remove files signaling a standby promotion request at postmaster startup 2015-09-09 22:52:40 +09:00
interfaces Change type of DOW/DOY to UNITS 2015-09-07 20:47:33 +01:00
makefiles Don't use deprecated dllwrap on Cygwin. 2014-02-01 16:13:32 -05:00
pl Fix plpython crash when returning string representation of a RECORD result. 2015-08-21 12:21:37 -04:00
port Fix a low-probability crash in our qsort implementation. 2015-07-16 22:57:46 -04:00
template AIX: Test the -qlonglong option before use. 2015-07-17 03:02:03 -04:00
test Fix subtransaction cleanup after an outer-subtransaction portal fails. 2015-09-04 13:36:50 -04:00
timezone Update time zone data files to tzdata release 2015d. 2015-05-15 19:35:58 -04:00
tools Turn install.bat into a pure one line wrapper fort he perl script. 2015-07-07 16:37:16 +03: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 Make numeric form of PG version number readily available in Makefiles. 2015-07-05 12:01:01 -04:00
Makefile.shlib Unlink static libraries before rebuilding them. 2015-03-01 13:06:39 -05:00
nls-global.mk NLS: Use msgmerge --previous option 2012-12-13 23:12:12 -05:00
win32.mak Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00