Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: cf/5809~1
Choose a base ref
...
head repository: postgresql-cfbot/postgresql
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: cf/5809
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Oct 21, 2025

  1. parallel pg_restore: avoid disk seeks when moving short distance forward

    Improve the performance of parallel pg_restore (-j) from a custom format
    pg_dump archive that does not include data offsets - typically happening
    when pg_dump has generated it by writing to stdout instead of a file.
    Also speeds up restoration of specific tables (-t tablename).
    
    In these cases, before the actual data restoration starts, pg_restore
    workers manifest constant looping of reading small sizes (4KB) and
    seeking forward small lenths (around 10KB for a compressed archive or
    even only a few bytes for uncompressed ones):
    
    read(4, "..."..., 4096) = 4096
    lseek(4, 55544369152, SEEK_SET)         = 55544369152
    read(4, "..."..., 4096) = 4096
    lseek(4, 55544381440, SEEK_SET)         = 55544381440
    read(4, "..."..., 4096) = 4096
    lseek(4, 55544397824, SEEK_SET)         = 55544397824
    read(4, "..."..., 4096) = 4096
    lseek(4, 55544414208, SEEK_SET)         = 55544414208
    read(4, "..."..., 4096) = 4096
    lseek(4, 55544426496, SEEK_SET)         = 55544426496
    
    This happens as each worker has to scan the whole file until it finds
    the entry it wants, skipping forward each block. In combination to the
    small block size of the custom format dump, this causes many seeks and
    low performance.
    
    Fix by avoiding forward seeks for jumping forward 32KB or less.
    Do instead sequential reads.
    
    Performance gain can be significant, depending on the size of the dump
    and the I/O subsystem. On my local NVMe drive, read speeds for that
    phase of pg_restore increased from 150MB/s to 3GB/s.
    jimis authored and Commitfest Bot committed Oct 21, 2025
    Configuration menu
    Copy the full SHA
    4fcfe3b View commit details
    Browse the repository at this point in the history
  2. [CF 5809] v5 - parallel pg_restore: avoid disk seeks when jumping sho…

    …rt distance forward
    
    This branch was automatically generated by a robot using patches from an
    email thread registered at:
    
    https://commitfest.postgresql.org/patch/5809
    
    The branch will be overwritten each time a new patch version is posted to
    the thread, and also periodically to check for bitrot caused by changes
    on the master branch.
    
    Patch(es): https://www.postgresql.org/message-id/[email protected]
    Author(s): Dimitrios Apostolou
    Commitfest Bot committed Oct 21, 2025
    Configuration menu
    Copy the full SHA
    158039f View commit details
    Browse the repository at this point in the history
Loading