From: Melanie Plageman <melanieplageman@gmail.com>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Reduce WAL generated when copying relation storage
Date: Fri, 20 Nov 2026 20:43:38 +0000
Message-ID: <E1xUVSL-00000000Ycd-2hrG@gemulon.postgresql.org> (raw)
Reduce WAL generated when copying relation storage
RelationCopyStorage() treated every page as nonstandard, logging the
region between pd_lower and pd_upper in full-page images even when it
was known to be free space.
Apply the same policy that db26517e79c established for
RelationCopyStorageUsingBuffer(): omit that region for heap and B-tree
main-fork pages, which are known to use the standard page layout. For
other pages, omit it only if the bounds are valid and the region
contains only zeroes. This reduces WAL volume without losing data on
pages with nonstandard layouts.
Author: Melanie Plageman <melanieplageman@gmail.com>
Reviewed-by: surya poondla <suryapoondla4@gmail.com>
Discussion: https://postgr.es/m/CAAKRu_b9r-Pz9gzYvC%2B5EHnXqNgfsJhcH%3DhuUGbXzvcnbHtxCg%40mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/ecb260853526019a1340ba8a6b4c6de27a07d69b
Modified Files
--------------
src/backend/access/heap/heapam_handler.c | 11 ++++++++---
src/backend/catalog/storage.c | 20 +++++++++++++++-----
src/backend/commands/tablecmds.c | 11 ++++++++---
src/include/catalog/storage.h | 3 ++-
src/test/recovery/t/018_wal_optimize.pl | 13 +++++++++++++
5 files changed, 46 insertions(+), 12 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: melanieplageman@gmail.com
Subject: Re: pgsql: Reduce WAL generated when copying relation storage
In-Reply-To: <E1xUVSL-00000000Ycd-2hrG@gemulon.postgresql.org>
References: <E1xUVSL-00000000Ycd-2hrG@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