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 1u0245-00ALez-DL for pgsql-general@arkaria.postgresql.org; Wed, 02 Apr 2025 17:39:49 +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 1u0243-00Gf9p-Qi for pgsql-general@arkaria.postgresql.org; Wed, 02 Apr 2025 17:39:47 +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 1u0242-00Gf9e-Rs for pgsql-general@lists.postgresql.org; Wed, 02 Apr 2025 17:39:47 +0000 Received: from fout-b1-smtp.messagingengine.com ([202.12.124.144]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u023z-0030mB-14 for pgsql-general@lists.postgresql.org; Wed, 02 Apr 2025 17:39:46 +0000 Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.stl.internal (Postfix) with ESMTP id 88EED1140138; Wed, 2 Apr 2025 13:39:40 -0400 (EDT) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-08.internal (MEProxy); Wed, 02 Apr 2025 13:39:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm1; t=1743615580; x=1743701980; bh=yW5XdsbJF7SRBETYR/oizfRTcY1GP/IzN7yVCfhmGmI=; b= PgoWZGGqmRRrv9Ol5KYB5gDaqpk70D6WZ1G58t0lzpWU1Oa0mBh+2d5kSmr2Y098 N4rORXZaxqZL3Xh93pWjpReszO+GX8Lo7iT8X2Nov0UVhAnzYeOvJsrLaMbGcBKx 9C3C8SQRiSV8lcKsu58ii/H1PqJ7q8AYPD+j1T52AwGPg81OxjVdAR8xJVbVVPZ7 4aCXhI+Rhu9BNdbv7pOAAxEtWcDQkb+HJp5+hSi+YemIh6rQTYPtS74g191l7l6m 8IAjFd6xAgPp+n6E+q9VgHChcsdH0CqElC4QaYKJKVxi1yqTTzrtN10R0hs7KVYO GRVEXox8IZAqBS4pZ8ZWgw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; t=1743615580; x=1743701980; bh=y W5XdsbJF7SRBETYR/oizfRTcY1GP/IzN7yVCfhmGmI=; b=ShPRuM2vs648u9lUB HLSEi/Lu274BaJl+2yH5QsFEeEGpsfLz+XmTx5Yk3Rx/vb3DVHw9mByOfHPOk271 3UhyXFGLlH34593X95/dh5eTJ5vdFgDJK5q84OtuyiBCEX3MWb6Ln/rwNEbPkZ40 D7JxAMFjoKTJY25CvCKlSf0YwhXgu8u/4aif7r6r9Y5s+aZpbjJD2VNVlKmHlbdu PHeLLvUlo4PMkNZ08otelMYj0Lt0sfW8rtxBad2jvRw1bEI0DTLp0rXkVMVmH5Nj Iv6DujwH08mIlNg5mUfkQO0gcrQvPTXRO3HdiIEHOG06lVAmYXTpcdO/E18W3eVS 0otFg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgddukeeivdekucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggv pdfurfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefkff ggfgfuvfhfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeetughrihgrnhcumfhlrghv vghruceorggurhhirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomheqnecuggftrf grthhtvghrnhepleegveekkeekueeigfdtveeileeuhfefudefteekjeffkeejueejheeg heegkedtnecuffhomhgrihhnpehpohhsthhgrhgvshhqlhdrohhrghenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghv vghrsegrkhhlrghvvghrrdgtohhmpdhnsggprhgtphhtthhopedvpdhmohguvgepshhmth hpohhuthdprhgtphhtthhopehjihhmihhssehgmhigrdhnvghtpdhrtghpthhtohepphhg shhqlhdqghgvnhgvrhgrlheslhhishhtshdrphhoshhtghhrvghsqhhlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Apr 2025 13:39:39 -0400 (EDT) Message-ID: <7d3fc27a-1229-4739-8d15-f4005dfa2435@aklaver.com> Date: Wed, 2 Apr 2025 10:39:36 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Performance issues during pg_restore -j with big partitioned table To: Dimitrios Apostolou , pgsql-general@lists.postgresql.org References: <84379bfb-bbda-84e6-cacc-e863ba9d6c37@gmx.net> Content-Language: en-US From: Adrian Klaver In-Reply-To: <84379bfb-bbda-84e6-cacc-e863ba9d6c37@gmx.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/2/25 10:32 AM, Dimitrios Apostolou wrote: > Hello list. > > My database includes one table with 1000 partitions, all of them rather > sizeable. I run: > >   pg_restore -j12 --no-tablespaces --disable-triggers --exit-on-error > --no-owner --no-privileges -n public -d newdb custom_format_dump.pgdump > > 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 waiting". >   I see that they are waiting to issue a TRUNCATE for one of the >   partitions and then COPY data to it.  Checking the log I see that >   several partitions have already been copied finished, but many more >   are left to start. > >   Why is a TRUNCATE needed at the start of a partition's COPY phase? I >   didn't issue a --clean on the command line (I don't need it as my >   database is newly created), and I don't see a mention of related >   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-57abc9cb2e54%40gmx.net "After each failed attempt, I need to issue a TRUNCATE table1,table2,... before I try again. " > > > Thanks in advance, > Dimitris > > -- Adrian Klaver adrian.klaver@aklaver.com