postgresql/src/backend/utils/cache
Tom Lane 8a7506e048 Reduce initial size of RelfilenodeMapHash.
A test case provided by Mathieu Fenniak shows that hash_seq_search'ing
this hashtable can consume a very significant amount of overhead during
logical decoding, which triggers frequent cache invalidation.  Testing
suggests that the actual population of the hashtable is often no more
than a few dozen entries, so we can cut the overhead just by dropping
the initial number of buckets down from 1024 --- I chose to cut it to 64.
(In situations where we do have a significant number of entries, we
shouldn't get any real penalty from doing this, as the dynahash.c code
will resize the hashtable automatically.)

This gives a further factor-of-two savings in Mathieu's test case.
That may be overly optimistic for real-world benefit, as real cases
may have larger average table populations, but it's hard to see it
turning into a net negative for any workload.

Back-patch to 9.4 where relfilenodemap.c was introduced.

Discussion: https://postgr.es/m/CAHoiPjzea6N0zuCi=+f9v_j94nfsy6y8SU7-=bp4=7qw6_i=Rg@mail.gmail.com
2017-05-12 18:30:02 -04:00
..
attoptcache.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
catcache.c Avoid searching for the target catcache in CatalogCacheIdInvalidate. 2017-05-12 18:17:29 -04:00
evtcache.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
inval.c Avoid searching for the target catcache in CatalogCacheIdInvalidate. 2017-05-12 18:17:29 -04:00
lsyscache.c Further patch rangetypes_selfuncs.c's statistics slot management. 2017-05-08 15:02:58 -04:00
Makefile Add infrastructure for mapping relfilenodes to relation OIDs. 2013-07-22 11:09:10 -04:00
plancache.c Invalidate cached plans on FDW option changes. 2017-01-06 14:12:52 -05:00
relcache.c Avoid returning stale attribute bitmaps in RelationGetIndexAttrBitmap(). 2017-02-06 13:20:21 -05:00
relfilenodemap.c Reduce initial size of RelfilenodeMapHash. 2017-05-12 18:30:02 -04:00
relmapper.c Reorganize our CRC source files again. 2015-04-14 17:03:42 +03:00
spccache.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
syscache.c Avoid searching for the target catcache in CatalogCacheIdInvalidate. 2017-05-12 18:17:29 -04:00
ts_cache.c Update copyright for 2015 2015-01-06 11:43:47 -05:00
typcache.c Avoid caching expression state trees for domain constraints across queries. 2015-11-29 18:18:42 -05:00