Re: [PING] [PATCH v2] parallel pg_restore: avoid disk seeks when jumping short distance forward
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Dimitrios Apostolou <jimis@gmx.net>
Cc: Nathan Bossart <nathandbossart@gmail.com>,
Thomas Munro <thomas.munro@gmail.com>,
pgsql-hackers@lists.postgresql.org
Date: 2025-10-11T02:22:16Z
Lists: pgsql-hackers
Attachments
- v2-0001-Fix-poor-buffering-logic-in-pg_dump-s-lz4-and-zst.patch (text/x-diff) patch v2-0001
- v2-0002-Try-to-align-the-block-sizes-of-pg_dump-s-various.patch (text/x-diff) patch v2-0002
I wrote: > I'm tempted to increase DEFAULT_IO_BUFFER_SIZE so that gzip > also produces blocks in the vicinity of 64K, but we'd have > to decouple the behavior of compress_lz4.c somehow, or it > would want to produce blocks around a megabyte which might > be excessive. (Or if it's not, we'd still want all these > compression methods to choose similar block sizes, I'd think.) After a bit of further experimentation, here is a v2 patchset. 0001 is like my previous patch except that it also fixes Zstd_write and Zstd_close so that the "stream API" code doesn't behave differently from the older API. Also, now with draft commit message. 0002 adjusts things so that lz4 and gzip compression produce block sizes around 128K, which is what compress_zstd.c already does after 0001. While I wouldn't necessarily follow zstd's lead if it were easy to do differently, it isn't. We'd have to ignore ZSTD_CStreamOutSize() in favor of making our own buffer size choice. That seems to carry some risks of tickling bugs that upstream isn't testing for, and the value of 128K is not so far off that I care to take any such risk. This brings us to a place where all three compression modes should yield roughly-comparable data block sizes, which is a good starting point for further discussion of whether pg_restore needs seek-versus-read adjustments. regards, tom lane
Commits
-
Avoid short seeks in pg_restore.
- fba60a1b107d 19 (unreleased) landed
-
Don't rely on zlib's gzgetc() macro.
- 277dec651472 19 (unreleased) cited
-
Add more TAP test coverage for pg_dump.
- 20ec9958921a 19 (unreleased) landed
-
Split 002_pg_dump.pl into two test files.
- 9dcf7f1172cd 19 (unreleased) landed
-
Align the data block sizes of pg_dump's various compression modes.
- 66ec01dc4124 19 (unreleased) landed
-
Fix serious performance problems in LZ4Stream_read_internal.
- 1f8062dd9668 19 (unreleased) landed
-
Fix poor buffering logic in pg_dump's lz4 and zstd compression code.
- fe8192a95e6c 19 (unreleased) landed
-
Fix issue with reading zero bytes in Gzip_read.
- bf18e9bd70de 17.7 landed
- a239c4a0c226 19 (unreleased) landed
- 6a4009747c36 18.1 landed
- 1518b7d76aad 16.11 landed
-
Restore test coverage of LZ4Stream_gets().
- eac2b1697d48 17.7 landed
- 661b320ed4e0 18.1 landed
- 26d1cd375f15 19 (unreleased) landed