]> granicus.if.org Git - postgresql/commit
Make catalog cache hash tables resizeable.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 5 Sep 2013 16:47:56 +0000 (19:47 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 5 Sep 2013 17:20:03 +0000 (20:20 +0300)
commit20cb18db4668b016748fbb5fcb1422bc3e0d52d1
tree82ee53ee378c3fc6fde586f7e3a628421eae7bf6
parentb1892aaeaaf34d8d1637221fc1cbda82ac3fcd71
Make catalog cache hash tables resizeable.

If the hash table backing a catalog cache becomes too full (fillfactor > 2),
enlarge it. A new buckets array, double the size of the old, is allocated,
and all entries in the old hash are moved to the right bucket in the new
hash.

This has two benefits. First, cache lookups don't get so expensive when
there are lots of entries in a cache, like if you access hundreds of
thousands of tables. Second, we can make the (initial) sizes of the caches
much smaller, which saves memory.

This patch dials down the initial sizes of the catcaches. The new sizes are
chosen so that a backend that only runs a few basic queries still won't need
to enlarge any of them.
src/backend/utils/cache/catcache.c
src/backend/utils/cache/syscache.c
src/include/utils/catcache.h