pgsql: Make DROP DATABASE command generate less WAL records.

From: Fujii Masao <fujii(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Make DROP DATABASE command generate less WAL records.
Date: 2019-11-21 12:11:58
Message-ID: E1iXlJW-00040N-Bo@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Make DROP DATABASE command generate less WAL records.

Previously DROP DATABASE generated as many XLOG_DBASE_DROP WAL records
as the number of tablespaces that the database to drop uses. This caused
the scans of shared_buffers as many times as the number of the tablespaces
during recovery because WAL replay of one XLOG_DBASE_DROP record needs
that full scan. This could make the recovery time longer especially
when shared_buffers is large.

This commit changes DROP DATABASE so that it generates only one
XLOG_DBASE_DROP record, and registers the information of all the tablespaces
into it. Then, WAL replay of XLOG_DBASE_DROP record needs full scan of
shared_buffers only once, and which may improve the recovery performance.

Author: Fujii Masao
Reviewed-by: Kirk Jamison, Simon Riggs
Discussion: https://postgr.es/m/CAHGQGwF8YwNH0ZaL+2wjZPkj+ji9UhC+Z4ScnG97WKtVY5L9iw@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/e6d8069522c8bde8239dd1fedfb4984efa4b3a1a

Modified Files
--------------
src/backend/access/rmgrdesc/dbasedesc.c | 7 +++-
src/backend/commands/dbcommands.c | 67 +++++++++++++++++++++++----------
src/include/commands/dbcommands_xlog.h | 5 ++-
3 files changed, 56 insertions(+), 23 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-11-21 12:17:40 Re: pgsql: Make DROP DATABASE command generate less WAL records.
Previous Message Fujii Masao 2019-11-21 10:56:05 pgsql: Allow ALTER VIEW command to rename the column in the view.