Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vAyA0-008Rdb-9n for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Oct 2025 22:15:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1vAy9z-004wbW-7J for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Oct 2025 22:15:22 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1vAy9y-004wbO-Ts for pgsql-hackers@lists.postgresql.org; Mon, 20 Oct 2025 22:15:21 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vAy9v-003JEu-2a for pgsql-hackers@lists.postgresql.org; Mon, 20 Oct 2025 22:15:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 59KMFD20381757; Mon, 20 Oct 2025 18:15:13 -0400 From: Tom Lane To: Dimitrios Apostolou cc: Chao Li , Nathan Bossart , Thomas Munro , pgsql-hackers@lists.postgresql.org Subject: Re: [PATCH v4] parallel pg_restore: avoid disk seeks when jumping short distance forward In-reply-to: <375562.1760995276@sss.pgh.pa.us> References: <2edb7a57-b225-3b23-a680-62ba90658fec@gmx.net> <1282067.1744651649@sss.pgh.pa.us> <5ed51587-5a24-4d79-e36e-927620d0e3a2@gmx.net> <72d2c81b-a0fe-3d99-9dd4-0d771e6e673e@gmx.net> <1po8os49-r63o-2923-p37n-12698o1qn7p0@tzk.arg> <3515357.1760128017@sss.pgh.pa.us> <3698234.1760149336@sss.pgh.pa.us> <3686.1760232320@sss.pgh.pa.us> <717335.1760389672@sss.pgh.pa.us> <1306492.1760556110@sss.pgh.pa.us> <1518975.1760634070@sss.pgh.pa.us> <9opr64ps-625r-667n-q19o-op35rs414n59@tzk.arg> <375562.1760995276@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Mon, 20 Oct 2025 17:21:16 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <381755.1760998513.1@sss.pgh.pa.us> Date: Mon, 20 Oct 2025 18:15:13 -0400 Message-ID: <381756.1760998513@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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