From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@postgresql.org
Subject: pgsql: Add a small cache of locks owned by a resource owner in Resource
Date: Thu, 21 Jun 2012 12:30:37 +0000
Message-ID: <E1ShgWz-00013h-Ve@gemulon.postgresql.org> (raw)
Add a small cache of locks owned by a resource owner in ResourceOwner.
This speeds up reassigning locks to the parent owner, when the transaction
holds a lot of locks, but only a few of them belong to the current resource
owner. This is particularly helps pg_dump when dumping a large number of
objects.
The cache can hold up to 15 locks in each resource owner. After that, the
cache is marked as overflowed, and we fall back to the old method of
scanning the whole local lock table. The tradeoff here is that the cache has
to be scanned whenever a lock is released, so if the cache is too large,
lock release becomes more expensive. 15 seems enough to cover pg_dump, and
doesn't have much impact on lock release.
Jeff Janes, reviewed by Amit Kapila and Heikki Linnakangas.
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/eeb6f37d89fc60c6449ca12ef9e91491069369cb
Modified Files
--------------
src/backend/storage/lmgr/lock.c | 154 ++++++++++++++++++++++-----------
src/backend/utils/resowner/resowner.c | 95 ++++++++++++++++++++-
src/include/storage/lock.h | 4 +-
src/include/utils/resowner.h | 5 +
4 files changed, 205 insertions(+), 53 deletions(-)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-committers@postgresql.org
Cc: heikki.linnakangas@iki.fi
Subject: Re: pgsql: Add a small cache of locks owned by a resource owner in Resource
In-Reply-To: <E1ShgWz-00013h-Ve@gemulon.postgresql.org>
References: <E1ShgWz-00013h-Ve@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox