[WIP PATCH v3] Implement "pg_restore --data-only --clean" as a way to skip WAL - Mailing list pgsql-hackers

From Dimitrios Apostolou
Subject [WIP PATCH v3] Implement "pg_restore --data-only --clean" as a way to skip WAL
Date
Msg-id 3eebf87a-2928-af48-ce96-c322ee113f62@gmx.net
Whole thread Raw
In response to Re: [WIP PATCH v2] Implement "pg_restore --data-only --clean" as a way to skip WAL  (Dimitrios Apostolou <jimis@gmx.net>)
List pgsql-hackers
Attaching v3 of the patch, together with a new test file that tests
previously untested flags of pg_restore.

Added to July's commitfest:
https://commitfest.postgresql.org/patch/5821/

On Thu, 12 Jun 2025, Dimitrios Apostolou wrote:
> I wonder about the following in pg_restore.c.
> Right now my implementation covers only parallel restore.
> In the case of non-parallel restore, I want to make the behaviour similar,
> i.e. each worker to issue a TRUNCATE before COPY starts.
> But then the StartTransaction() doesn't make sense, as everything might
> already be in a transaction because of --single-transaction.
> Should I completely skip StartTransaction() if !is_parallel?

In the end, I followed the same code path for both parallel and
non-parallel pg_restore. It works even with --single-transaction, where
apparently there are several nested transactions.

The tests pass, so I assume it's OK to start a subtransaction for each
table restoration inside the global single-transaction.


Dimitris




pgsql-hackers by date:

Previous
From: Sungwoo Chang
Date:
Subject: Re: Fwd: dsm_registry: Add detach and destroy features
Next
From: Dimitrios Apostolou
Date:
Subject: Re: [PATCH v2] parallel pg_restore: move offset-building phase to before forking