pgsql: Make catalog cache hash tables resizeable.

From: Heikki Linnakangas <heikki(dot)linnakangas(at)iki(dot)fi>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make catalog cache hash tables resizeable.
Date: 2013-09-05 17:29:09
Message-ID: E1VHdMj-0002ro-U5@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Kevin Grittner 2013-09-05 19:11:26 pgsql: Eliminate pg_rewrite.ev_attr column and related dead code.
Previous Message Jeff Davis 2013-09-05 14:31:47 pgsql: Improve Range Types and Exclusion Constraints example.