We have an optimization to bulkload date in pg_restore, but the code only works in parallel restore (--jobs >= 2). Why don't we do the same optimization in the serial restore (--jobs = 1) ?
We checks is_parallel to decide to use BEGIN-TRUNCATE-COPY: if (is_parallel && te->created) but we can always do it unless --single-transaction, right? if (!ropt->single_txn && te->created) [ in restore_toc_entry() ] /* * In parallel restore, if we created the table earlier in * the run then we wrap the COPY in a transaction and * precede it with a TRUNCATE. If archiving is not on * this prevents WAL-logging the COPY. This obtains a * speedup similar to that from using single_txn mode in * non-parallel restores. */ if (is_parallel && te->created) <==== HERE { /* * Parallel restore is always talking directly to a * server, so no need to see if we should issue BEGIN. */ StartTransaction(AH); /* * If the server version is >= 8.4, make sure we issue * TRUNCATE with ONLY so that child tables are not * wiped. */ ahprintf(AH, "TRUNCATE TABLE %s%s;\n\n", (PQserverVersion(AH->connection) >= 80400 ? "ONLY " : ""), fmtId(te->tag)); } Regards, --- Takahiro Itagaki NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers