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 1u02Au-00ANRy-9Q for pgsql-general@arkaria.postgresql.org; Wed, 02 Apr 2025 17:46:52 +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 1u02At-00Go4w-0l for pgsql-general@arkaria.postgresql.org; Wed, 02 Apr 2025 17:46:51 +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 1u02As-00Go4l-N4 for pgsql-general@lists.postgresql.org; Wed, 02 Apr 2025 17:46:50 +0000 Received: from mout.gmx.net ([212.227.15.18]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u02Aq-0030qU-0z for pgsql-general@lists.postgresql.org; Wed, 02 Apr 2025 17:46:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1743616005; x=1744220805; i=jimis@gmx.net; bh=HdrxWSO1U7FHvB4QHHQ1kyqOI/SiZC3+RORxNs7F9H4=; h=X-UI-Sender-Class:Date:From:To:cc:Subject:In-Reply-To:Message-ID: References:MIME-Version:Content-Type:cc:content-transfer-encoding: content-type:date:from:message-id:mime-version:reply-to:subject: to; b=pysWROa/k4GCHIwZGz8dGMUMa9VHbwC5Ssr/HHsiPpSE5VXpWRo2phh4WOyfd4+8 xUbQQfYQjdfDr5OVSocSc9GkfDmTdT/hMTwZVzoY4xUlL/U8/jbndKgFxq/4RHBs+ qZ2dZ3oDZcxBr5tLUIPFh1qCYXk0Z9AHk/gbf3HdacVDFUPLsK5IXjUj1aicmqkME i4vkdCFkGcAbQ6EXfTNtAd3WB/2OjPI7nCEyUwnDfhckzsqB7DK9TE96X6TSbEFxo CxJ9E5LswTCbsCjcNXi48tgklKKAU5IeLXBg1zS/pxa8OJ22BB+TLzUCGq3OmkShC 81oQTCxRheC45FieXg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [10.9.70.81] ([185.55.106.54]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MnakR-1tGls138Ev-00biqA; Wed, 02 Apr 2025 19:46:44 +0200 Date: Wed, 2 Apr 2025 19:46:43 +0200 (CEST) From: Dimitrios Apostolou To: Adrian Klaver cc: pgsql-general@lists.postgresql.org Subject: Re: Performance issues during pg_restore -j with big partitioned table In-Reply-To: <7d3fc27a-1229-4739-8d15-f4005dfa2435@aklaver.com> Message-ID: <422f9998-e190-895f-c1de-a8423cb4531d@gmx.net> References: <84379bfb-bbda-84e6-cacc-e863ba9d6c37@gmx.net> <7d3fc27a-1229-4739-8d15-f4005dfa2435@aklaver.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-422439159-1743616004=:139110" X-Provags-ID: V03:K1:cSDSd9NApy4YY83ErE3jb6O2oqfYk2sTQvhywo9TowpdAiffhIA ZT0fdiDpaHFUpB1WMa/+CQgar8kl8WxUs+zSSnIkYiFUCKxv95BNTcU3Csy9uZ9gojb5jlJ FcIxUVtdizaoXXJer4t41eJ/D46gfMYfEY1M1icM0FxgQnPr7IfrBPuFS5QBe+05JBAmRdx R1M+OVbZyVEpaezS0CvZg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:6JluJVung+Q=;ZUPhT/+Ws8PqnP7ttCNw1C7qxZI MakN1jI0VKzcB7FxOQtphn04HlQvyF+m6kWxBwe314oAFVL/vfJYM2eCO0yfFLYh7R3b1Bnre i0woqLDi6mJK2BrqzWV3siRW8bNSexTH9jVwo6iWqvH8wd/kX7N/QVmzV9N8OZxKhdJBfLWW1 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ldyMv0JF s2MXz8SDswrze/G/IwH4jJWnYE+XMuq6+75dI51SS524PN4Or5PiyqVrHXM7j2eDrwAVDqIGC HTm8f9S19DA7IkkeJnlVxtMJbGtkoyXprnbx1I8ejCgIUnvOkHaU85i3fRzSQ8pFTp9gQn0XV i2U90AYsYs8YMtXZMoD4/yXXSujdqOt3h/G1nfVwSPFi3IdDbF5cRn+02A7qGp4PLi9Ucq0dw 9FlsSMRp7Kyb6crNWmOrXMz5Tp/k= List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --0-422439159-1743616004=:139110 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On Wed, 2 Apr 2025, Adrian Klaver wrote: > > > On 4/2/25 10:32 AM, Dimitrios Apostolou wrote: >> Hello list. >> >> My database includes one table with 1000 partitions, all of them rathe= r >> sizeable. I run: >> >> =C2=A0 pg_restore -j12 --no-tablespaces --disable-triggers --exit-on-e= rror >> --no-owner --no-privileges -n public -d newdb custom_format_dump.pgdum= p >> >> Right now after 24h of restore, I notice weird behaviour, so I have >> several questions about it: >> >> + 11 postgres backend processes are sleeping as "TRUNCATE TABLE waitin= g". >> =C2=A0 I see that they are waiting to issue a TRUNCATE for one of the >> =C2=A0 partitions and then COPY data to it.=C2=A0 Checking the log I = see that >> =C2=A0 several partitions have already been copied finished, but many= more >> =C2=A0 are left to start. >> >> =C2=A0 Why is a TRUNCATE needed at the start of a partition's COPY ph= ase? I >> =C2=A0 didn't issue a --clean on the command line (I don't need it as= my >> =C2=A0 database is newly created), and I don't see a mention of relat= ed >> =C2=A0 TRUNCATE in the pg_restore manual. > > --clean will drop the object entirely not TRUNCATE. > > I'm guessing that this is being done by you per: > > https://www.postgresql.org/message-id/53760c70-4a87-a453-9e02-57abc9cb2e= 54%40gmx.net > > "After each failed attempt, I need to issue a TRUNCATE table1,table2,... > before I try again. " Thanks Adrian. I'm now testing restore without --data-only. All I'm doing prior to the above pg_restore command is "createdb -T template0 newdb". It's possible though that I'm missing something here, the whole thing is way more complicated than I expected... Dimitris --0-422439159-1743616004=:139110--