pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <fujii@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Improve the performance of relation deletes during recovery.
Date: Wed, 04 Jul 2018 18:00:38 +0000
Message-ID: <E1fam50-0006zZ-RH@gemulon.postgresql.org> (raw)

Improve the performance of relation deletes during recovery.

When multiple relations are deleted at the same transaction,
the files of those relations are deleted by one call to smgrdounlinkall(),
which leads to scan whole shared_buffers only one time. OTOH,
previously, during recovery, smgrdounlink() (not smgrdounlinkall()) was
called for each file to delete, which led to scan shared_buffers
multiple times. Obviously this could cause to increase the WAL replay
time very much especially when shared_buffers was huge.

To alleviate this situation, this commit changes the recovery so that
it also calls smgrdounlinkall() only one time to delete multiple
relation files.

This is just fix for oversight of commit 279628a0a7, not new feature.
So, per discussion on pgsql-hackers, we concluded to backpatch this
to all supported versions.

Author: Fujii Masao
Reviewed-by: Michael Paquier, Andres Freund, Thomas Munro, Kyotaro Horiguchi, Takayuki Tsunakawa
Discussion: https://postgr.es/m/CAHGQGwHVQkdfDqtvGVkty+19cQakAydXn1etGND3X0PHbZ3+6w@mail.gmail.com

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8463be060d4c4b67b1382607433ea1a3a51002e5

Modified Files
--------------
src/backend/access/transam/twophase.c |  9 ++-------
src/backend/access/transam/xact.c     | 25 +++--------------------
src/backend/storage/smgr/md.c         | 38 +++++++++++++++++++++++++++++++++++
src/include/storage/smgr.h            |  1 +
4 files changed, 44 insertions(+), 29 deletions(-)



view thread (7+ messages)  latest in thread

Message-ID: <E1fam50-0006zZ-RH@gemulon.postgresql.org>
Permalink:  ../E1fam50-0006zZ-RH@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1fam50-0006zZ-RH@gemulon.postgresql.org

 · 

reply

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: fujii@postgresql.org
  Subject: Re: pgsql: Improve the performance of relation deletes during recovery.
  In-Reply-To: <E1fam50-0006zZ-RH@gemulon.postgresql.org>
  References: <E1fam50-0006zZ-RH@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