pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Ron Johnson <ronljohnsonjr@gmail.com>
Cc: pgsql-general@lists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: pg_restore enhancements
Date: Thu, 23 Nov 2023 10:55:36 -0500
Message-ID: <2659882.1700754936@sss.pgh.pa.us> (raw)
In-Reply-To: <CANzqJaC7ZOvtM6ejtZ2m0_-O49ze2MUjg5LfH9X6dacafWEtuw@mail.gmail.com>
References: <362032628.6955904.1700659540303.ref@mail.yahoo.com>
	<362032628.6955904.1700659540303@mail.yahoo.com>
	<cc0c5cf5-4674-46a0-9c20-053aac907faa@aklaver.com>
	<383739960.7061560.1700672154915@mail.yahoo.com>
	<368f73d6c7a1530d82f9c1c12a2cd0a14780b37a.camel@cybertec.at>
	<CANzqJaC7ZOvtM6ejtZ2m0_-O49ze2MUjg5LfH9X6dacafWEtuw@mail.gmail.com>

Ron Johnson <ronljohnsonjr@gmail.com> writes:
> On Thu, Nov 23, 2023 at 3:37 AM Laurenz Albe <laurenz.albe@cybertec.at>
> wrote:
>> You can avoidwriting WAL if you set "wal_level = minimal", restart
>> PostgreSQL
>> and restore the dump with the --single-transaction option.

> Why does "--single-transaction" prevent WAL writes?  I'd expect _more_
> pg_wal growth from One Ginormous Transaction.

I don't recall all the details offhand, but there's some optimization
concerned with not writing WAL if COPY's target table was created in
the current transaction.  WAL will still be made for the catalog
changes, but usually the bulk of the WAL for a pg_restore run comes
from loading data, and this recipe eliminates that.  (Of course,
you cannot use it on a replication primary.)

			regards, tom lane





view thread (11+ messages)  latest in thread

Message-ID: <2659882.1700754936@sss.pgh.pa.us>
Permalink:  ../2659882.1700754936@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2659882.1700754936@sss.pgh.pa.us

 · 

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-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, ronljohnsonjr@gmail.com
  Subject: Re: pg_restore enhancements
  In-Reply-To: <2659882.1700754936@sss.pgh.pa.us>
  References: <362032628.6955904.1700659540303.ref@mail.yahoo.com> <362032628.6955904.1700659540303@mail.yahoo.com> <cc0c5cf5-4674-46a0-9c20-053aac907faa@aklaver.com> <383739960.7061560.1700672154915@mail.yahoo.com> <368f73d6c7a1530d82f9c1c12a2cd0a14780b37a.camel@cybertec.at> <CANzqJaC7ZOvtM6ejtZ2m0_-O49ze2MUjg5LfH9X6dacafWEtuw@mail.gmail.com> <2659882.1700754936@sss.pgh.pa.us>

* 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