Re: [WIP PATCH v2] Implement "pg_restore --data-only --clean" as a way to skip WAL
От | Dimitrios Apostolou |
---|---|
Тема | Re: [WIP PATCH v2] Implement "pg_restore --data-only --clean" as a way to skip WAL |
Дата | |
Msg-id | 850fc61f-be21-1993-b23d-6d8235978b63@gmx.net обсуждение исходный текст |
Ответ на | [WIP PATCH v2] Implement "pg_restore --data-only --clean" as a way to skip WAL (Dimitrios Apostolou <jimis@gmx.net>) |
Ответы |
[WIP PATCH v3] Implement "pg_restore --data-only --clean" as a way to skip WAL
|
Список | 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));
В списке pgsql-hackers по дате отправления: