Re: [PATCH v4] parallel pg_restore: avoid disk seeks when jumping short distance forward

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Dimitrios Apostolou <jimis(at)gmx(dot)net>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: [PATCH v4] parallel pg_restore: avoid disk seeks when jumping short distance forward
Date: 2025-10-20 22:15:13
Message-ID: 381756.1760998513@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> So for me, the proposed patch actually makes it 2X slower.

I went and tried this same test case on a 2024 Mac Mini M4 Pro.
Cutting to the chase:

HEAD:

$ time pg_restore -f /dev/null -t zedtable bench10000.dump

real 1m26.525s
user 0m0.364s
sys 0m6.806s

Patched:

$ time pg_restore -f /dev/null -t zedtable bench10000.dump

real 0m15.419s
user 0m0.279s
sys 0m8.224s

So on this hardware it *does* win (although maybe things would
be different for a parallel restore). The patched pg_restore
takes just about the same amount of time as "cat", and iostat
shows both of them reaching a bit more than 6GB/s read speed.

My feeling at this point is that we'd probably drop the block
size test as irrelevant, and instead simply ignore ctx->hasSeek
within this loop if we think we're on a platform where that's
the right thing. But how do we figure that out?

Not sure where we go from here, but clearly a bunch of research
is going to be needed to decide whether this is committable.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2025-10-20 22:18:50 Re: Logical Replication of sequences
Previous Message Dimitrios Apostolou 2025-10-20 22:09:46 Re: [PATCH v4] parallel pg_restore: avoid disk seeks when jumping short distance forward