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.96) (envelope-from ) id 1vSPVn-00E13O-2m for pgsql-performance@arkaria.postgresql.org; Mon, 08 Dec 2025 00:54:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vSPVl-00EFje-0T for pgsql-performance@arkaria.postgresql.org; Mon, 08 Dec 2025 00:53:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vSPVk-00EFjW-2I for pgsql-performance@lists.postgresql.org; Mon, 08 Dec 2025 00:53:57 +0000 Received: from mail-vs1-xe29.google.com ([2607:f8b0:4864:20::e29]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vSPVi-003fdZ-0i for pgsql-performance@lists.postgresql.org; Mon, 08 Dec 2025 00:53:55 +0000 Received: by mail-vs1-xe29.google.com with SMTP id ada2fe7eead31-5dfc6be7df3so1456483137.0 for ; Sun, 07 Dec 2025 16:53:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765155233; x=1765760033; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=AkoHDpplRubYfSVCmfJurJxiqB9iV7XQN974bGKbdSQ=; b=CxytRJLHbzFbuIWdu8NNilPFzDZzEKgp3/dQjtzjOmYHdo8dFDE1UdoljaAMStxoNz P3yhnTmtKfrWqXTuACtOvJ2ibSI/uL0mxFhK5Lxq8sGDoJEt7XOoX9LXZSMHlCTegKW1 PcH5cypyGEit7QW8Li+YlSg+fMz5k1CM0TU7jZ3CeOcD3LMEPT8fXZmwMw8TYpHjoiku XDIgWDeuKe2QR/I1g4Rx4Bcj51g2Javmyv5XDjsx4ElmPDzEeSOFrPjrGu1aA0lhxYgo wh5y3CEs3PnswGVBWtzgRjEzib3gYJfccJJ6SZxECSsOYYjGD+5gW4ndMD7SMTRrsVyc S5jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765155233; x=1765760033; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=AkoHDpplRubYfSVCmfJurJxiqB9iV7XQN974bGKbdSQ=; b=HXvQXrLzE3wRlpb6RFVGlxa2sJAOqP1lfs7dyxmbamwyU3XWW1TiXl+rv53AHqBSrX 0WhMig5DDOEdXPVWlw1aYx/wqpcmbX+7OG+S9hh3LgLGAsftIm3YLiKS1doCfyW2x1PI HIjaRS1q+PGMVR8ejnAXoiZgbdz/jYuRp7F+P4TBIoyxAfANHUSXR6xaPgltewsL8LtJ OFd9kRe9RNz+H9OahW/E8wu2GwYajHh2PZifmigZZgLX5M1T9bmNdIUrhFlaIXRvzzgh U6A44ou4FHIrvyb8pL3z5P0APIQjd0JScCivNW/CNdj1m3hLih9wRKlm2ru4slKK5k8s H2RQ== X-Gm-Message-State: AOJu0YwTGNHV5vcvD7d9gWi6l+2tv/vctwesHwopcahXjoSUGQXNyiEz 1VafqzHzRbSsPiHWk3Mk5W0JM2C7Kci0Y2PtZTlEqOu1CLIJ89cAcpmNhsSn0YgAepfTtjoJI73 MSrkKLs8xtLn3Osnc8N0tVyJiUoPMlQ== X-Gm-Gg: ASbGnctIdsYbjOaf5NjCjATbGKnbV47Ku4a/AW3TLeFCZJwCz7ZDt4Gc7+6o2KE/Qal lxjLGTsbZ5phFGV2MMA2mY3I6czQkYRb4K9cJdHAIP1bUeezDx3UWtVxHKs/6u/jLpzc2JfDYsw pgZQYvXSrdsan9S8O4azgiw154CCKA1FP+jKrPdGnfeXwMZMPrLRp+Ad3/bA1Arp9lwLigQNFiH 2tWt+vIjP70yLp/iZBzBNzv1H6bdXhl4sLTrtsryxWi0s2+1cDgQLonNfMIvWmnTNv/i2M2d6lH 9T57gTTfAKkOIw3LH89UgWFUAQ== X-Google-Smtp-Source: AGHT+IEOJQ3Hhj53kDNmmMNP74lrJSfwiX+YIsR2Gnu3IzlpSmWWye8A29QtC4i0aazGuJv+jrT70DsEM6lByAs5Mmo= X-Received: by 2002:a05:6102:dcc:b0:5db:f710:497e with SMTP id ada2fe7eead31-5e52cbdccd8mr1657157137.21.1765155233386; Sun, 07 Dec 2025 16:53:53 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Jeff Janes Date: Sun, 7 Dec 2025 19:53:40 -0500 X-Gm-Features: AQt7F2pKDdUw9ws8wQSPG8ICAVaS4eVAyOpsUxqyluAmHT9lLAgC6ql6kb5KMz4 Message-ID: Subject: Re: Seeking guidance on extremely slow pg_restore despite strong I/O performance To: MentionTheElephant Cc: pgsql-performance@lists.postgresql.org Content-Type: multipart/alternative; boundary="000000000000a8d2ba0645663a53" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000a8d2ba0645663a53 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Dec 5, 2025 at 5:30=E2=80=AFAM MentionTheElephant < MentionTheElephant@gmail.com> wrote: > The central question is: What should I examine further to understand > why checkpoint processing becomes the dominant bottleneck during > restore, despite fsync=3Doff, synchronous_commit=3Doff, and excellent random write latency? > I don't see any evidence that checkpoint is the dominant bottleneck. Checkpoints are not (usually) meant to be fast. They pace themselves to finish in the allotted time, while causing the least amount of drama while they are underway. The whole system shouldn't freeze up while waiting for a checkpoint to run. > Checkpoints appear to > stall the entire restore process. > What makes it appear that way? Is it just that they take a long time to finish, or is there some other evidence you haven't described? > Example log excerpts show checkpoint write times consistently in the > range of 600=E2=80=931100 seconds, with large numbers of buffers written = (from > hundreds of thousands to over 1.6 million). You told it to shoot for checkpoint_timeout * checkpoint_completion_target =3D 3600 * 0.9 =3D 3240 seconds. If anything, it is weird that it takes so little time, compared to what you authorized it to take. As for the number of buffers, it writes as many as it needs to write to get the job done. Are the checkpoints driven by time, or by WAL volume? The time reported for the write phase includes not only time spent doing the writes, but also time spent sleeping so as to pace the checkpoint to finish on schedule. Perhaps those times should be reported separately. I think that you have misinterpreted the evidence you have on hand, and are now looking for an explanation for something which isn't true in the first place. What is the percent IO wait (called "wa") reported by `top` or `vmstat` while the restore is running? If you run with --verbose, you can see each step as it starts them. Which steps take the most time? Cheers, Jeff --000000000000a8d2ba0645663a53 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Dec 5, 2025 at 5:30=E2=80=AFAM Me= ntionTheElephant <Mentio= nTheElephant@gmail.com> wrote:
=C2=A0
The central question is: What should I examine further to unders= tand
why checkpoint processing becomes the dominant bottleneck during
restore, despite fsync=3Doff, synchronous_commit=3Doff, and excellent=C2=A0=
random write= latency?

I don't see any evidence = that checkpoint is the dominant bottleneck. Checkpoints are not (usually) m= eant to be fast.=C2=A0 They pace themselves to finish in the allotted=C2=A0= time, while=C2=A0causing the least amount of drama while they are underway.= =C2=A0 The whole system shouldn't freeze up while waiting for a checkpo= int to run.
=C2=A0
> Checkpoints appear to
stall the entire restore process.

What = makes it appear that way? Is it just that they take a long time to finish,= =C2=A0or is there some other evidence you=C2=A0haven't described?
=
=C2=A0
Example log excerpts show checkpoint write times consistently in the
range of 600=E2=80=931100 seconds, with large numbers of buffers written (f= rom
hundreds of thousands to over 1.6 million).

You told it to shoot for=C2=A0checkpoint_timeout * checkpoint_completion_= target =3D 3600 * 0.9 =3D 3240 seconds.=C2=A0 If anything, it is weird that= it takes so little time,=C2=A0compared to what you authorized it=C2=A0to t= ake.=C2=A0 As for the number of buffers, it writes as many as it needs to w= rite to get the job done.=C2=A0 Are the checkpoints driven by time, or by W= AL volume?

The time reported for the write phase i= ncludes not only time spent doing the writes, but also time spent sleeping = so as to pace the checkpoint to finish on schedule.=C2=A0 Perhaps those tim= es should be reported separately.

I think that you= have misinterpreted=C2=A0the evidence you have on hand, and are now lookin= g for an explanation for something which isn't true in=C2=A0the first p= lace.

What is the percent IO wait (called "wa= ") reported by `top` or `vmstat` while the restore is running?

If you run with --verbose, you can see each step as it st= arts them. Which steps take the most time?

Cheers,=

Jeff
--000000000000a8d2ba0645663a53--