From: Simon Riggs <simon@2ndQuadrant.com>
To: pgsql-committers@postgresql.org
Subject: pgsql: Improve performance of replay of AccessExclusiveLocks
Date: Wed, 22 Mar 2017 13:11:03 +0000
Message-ID: <E1cqg2Z-0002es-HM@gemulon.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-committers>
Improve performance of replay of AccessExclusiveLocks
A hot standby replica keeps a list of Access Exclusive locks for a top
level transaction. These locks are released when the top level transaction
ends. Searching of this list is O(N^2), and each transaction had to pay the
price of searching this list for locks, even if it didn't take any AE
locks itself.
This patch optimizes this case by having the master server track which
transactions took AE locks, and passes that along to the standby server in
the commit/abort record. This allows the standby to only try to release
locks for transactions which actually took any, avoiding the majority of
the performance issue.
Refactor MyXactAccessedTempRel into MyXactFlags to allow minimal additional
cruft with this.
Analysis and initial patch by David Rowley
Author: David Rowley and Simon Riggs
Branch
------
master
Details
-------
http://git.postgresql.org/pg/commitdiff/9b013dc238cefa2860b384a3fa016ad1ceb062e4
Modified Files
--------------
src/backend/access/heap/heapam.c | 4 ++--
src/backend/access/transam/twophase.c | 12 ++++++++++--
src/backend/access/transam/xact.c | 33 +++++++++++++++++++++------------
src/backend/commands/tablecmds.c | 2 +-
src/backend/storage/ipc/standby.c | 1 +
src/include/access/xact.h | 27 ++++++++++++++++++++++++---
6 files changed, 59 insertions(+), 20 deletions(-)
--
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers
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: simon@2ndQuadrant.com
Subject: Re: pgsql: Improve performance of replay of AccessExclusiveLocks
In-Reply-To: <E1cqg2Z-0002es-HM@gemulon.postgresql.org>
References: <E1cqg2Z-0002es-HM@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