pgsql: Make catalog cache hash tables resizeable. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Make catalog cache hash tables resizeable.
Date
Msg-id E1VHdMj-0002ro-U5@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/20cb18db4668b016748fbb5fcb1422bc3e0d52d1

Modified Files
--------------
src/backend/utils/cache/catcache.c |   52 ++++++++++++++++--
src/backend/utils/cache/syscache.c |  104 ++++++++++++++++++------------------
src/include/utils/catcache.h       |    4 +-
3 files changed, 102 insertions(+), 58 deletions(-)


pgsql-committers by date:

Previous
From: Jeff Davis
Date:
Subject: pgsql: Improve Range Types and Exclusion Constraints example.
Next
From: Kevin Grittner
Date:
Subject: pgsql: Eliminate pg_rewrite.ev_attr column and related dead code.