| From: | Dimitrios Apostolou <jimis(at)gmx(dot)net> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Re: [WIP PATCH v2] Implement "pg_restore --data-only --clean" as a way to skip WAL |
| Date: | 2025-06-12 17:23:29 |
| Message-ID: | 850fc61f-be21-1993-b23d-6d8235978b63@gmx.net |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
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?
- use_truncate = is_parallel && te->created &&
+ use_truncate = is_parallel &&
+ (te->created || (ropt->dumpData && ropt->clean)) &&
!is_load_via_partition_root(te);
if (use_truncate)
{
+ pg_log_debug("BEGIN transaction and TRUNCATE table \"%s.%s\"",
+ te->namespace, te->tag);
+
/*
* Parallel restore is always talking directly to a
* server, so no need to see if we should issue BEGIN.
*/
StartTransaction(&AH->public);
/*
* Issue TRUNCATE with ONLY so that child tables are
* not wiped.
*/
ahprintf(AH, "TRUNCATE TABLE ONLY %s;\n\n",
fmtQualifiedId(te->namespace, te->tag));
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Robert Haas | 2025-06-12 17:36:28 | Re: pg_dump --with-* options |
| Previous Message | Nathan Bossart | 2025-06-12 17:23:11 | Re: pg_dump --with-* options |