mirror of
https://github.com/postgres/postgres.git
synced 2025-04-20 00:42:27 +03:00
Skip second WriteToc() call for custom-format dumps without data.
Presently, "pg_dump --format=custom" calls WriteToc() twice. The second call updates the data offset information, which allegedly makes parallel pg_restore significantly faster. However, if we're not dumping any data, there are no data offsets to update, so we can skip this step. Reviewed-by: Jeff Davis <pgsql@j-davis.com> Discussion: https://postgr.es/m/Z9c1rbzZegYQTOQE%40nathan
This commit is contained in:
parent
d9c7911e1a
commit
e3cc039a7d
@ -755,9 +755,11 @@ _CloseArchive(ArchiveHandle *AH)
|
|||||||
* If possible, re-write the TOC in order to update the data offset
|
* If possible, re-write the TOC in order to update the data offset
|
||||||
* information. This is not essential, as pg_restore can cope in most
|
* information. This is not essential, as pg_restore can cope in most
|
||||||
* cases without it; but it can make pg_restore significantly faster
|
* cases without it; but it can make pg_restore significantly faster
|
||||||
* in some situations (especially parallel restore).
|
* in some situations (especially parallel restore). We can skip this
|
||||||
|
* step if we're not dumping any data; there are no offsets to update
|
||||||
|
* in that case.
|
||||||
*/
|
*/
|
||||||
if (ctx->hasSeek &&
|
if (ctx->hasSeek && AH->public.dopt->dumpData &&
|
||||||
fseeko(AH->FH, tpos, SEEK_SET) == 0)
|
fseeko(AH->FH, tpos, SEEK_SET) == 0)
|
||||||
WriteToc(AH);
|
WriteToc(AH);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user