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 1twij3-00GvOu-CA for pgsql-general@arkaria.postgresql.org; Mon, 24 Mar 2025 14:24:25 +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 1twij1-00456L-Ul for pgsql-general@arkaria.postgresql.org; Mon, 24 Mar 2025 14:24:23 +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.94.2) (envelope-from ) id 1twij1-00455b-H8 for pgsql-general@lists.postgresql.org; Mon, 24 Mar 2025 14:24:23 +0000 Received: from mout.gmx.net ([212.227.17.21]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1twiiz-000ryF-21 for pgsql-general@lists.postgresql.org; Mon, 24 Mar 2025 14:24:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1742826258; x=1743431058; i=jimis@gmx.net; bh=IR4KEs5fJ9BubN+E+y+n1vpXA/QrMuyz966RJU5ijhQ=; 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=TKpvLyBIzjbuDZUHx+MShleBMK8Qps2Hg1YUAL4Yf5qf5y2Xe8joZTMttQB2sVfE UO9qtYHCcv9srF5CMKwU+HYkKs9rKJKUzV3oHSSHhOFT7jGcnxuWZu9QdBkdB0gnl 4u+8+6op2eH8DT62iLo9yHLYgRxn2rhT19trkigLgdmkBq17b6VF5BlYXC3L8svsG oP5ieRfre7CzUxRlLBxFvJIADtLONeeJQyrvgP4w2HTr5dsmhPz09zGyIZHTXVvIX ovtWc8qGZUcBoZWpsQXciUCuE8bOv40HFQ9FPXI56+bAAz5qO5Yreu/2KGMwD9uRp ziib5gB0jIlizg/++Q== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [10.9.70.81] ([185.55.106.54]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1M2wGi-1u01302XIy-0098DJ; Mon, 24 Mar 2025 15:24:18 +0100 Date: Mon, 24 Mar 2025 15:24:17 +0100 (CET) From: Dimitrios Apostolou To: Laurenz Albe cc: pgsql-general@lists.postgresql.org Subject: Re: Experience and feedback on pg_restore --data-only In-Reply-To: <455d28421ae33c73b73a6f527d2f72816ca5dd29.camel@cybertec.at> Message-ID: <5f1ebeda-f080-cb31-75c0-ce2211ea348f@gmx.net> References: <53760c70-4a87-a453-9e02-57abc9cb2e54@gmx.net> <455d28421ae33c73b73a6f527d2f72816ca5dd29.camel@cybertec.at> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-390209832-1742826258=:1515035" X-Provags-ID: V03:K1:dpWucF5Z1auSuBRDlxY+MI/k9FiOT0ePLzqOhW5OZua0dkxmtb4 p1HQHHkAx4QR6D1T2wN5TrynikAEIiVhOoDNFc93Qh3hXo9u6atXNFjNMGYk55yChuCLOzc lOj2tlFnXtE6zUXGyxTjf6m8l47UEjsalI4vSM3iacq5AAAbIGVj+BFxswpGSS2eHPAax8z So8MMOgn+QQo/Gmpv/soQ== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:J0pieDXZ1Mc=;AsjM4e9bt4YOCJaR/M6EdFIt+sA M+eoM1jiOKz+PkqcxX3JedzS92V8vPkKEi4Mgcit7vnYp5QHpoqqQhc0vA4JjSkqH81CHquN6 XMaSvA8KNC8nSMmaJHVE408SSIAMD3ldTBqdNMGjCa7QOEvhHGJB3lGjPUFV8ruuuNX0GNB1i g0rii81qqep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hPkX+38Fq/qS GNJcnm0IreXHY3emSFrsex2Y7J4mRhuBJzxKJp+aplsFHKTg32XCyrbD00HO9McuN4Kp0vJWo xA70m1LwQ/XPXuQdRBbeA7Ep+sBbczwHVvtd58m97+FYwC56vOFtJ5LPjYlaEAOqkd3VmGZ/Y QekmXSTQSAIg5Y0auTb52lmkGhIOQFamb/0KR0bUGIq7tzgBAj/cLN0hlcBVKSSuyDUBe+1Je I2/CxEnMhU2k09zHfR4rBOwFv5jg= 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-390209832-1742826258=:1515035 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable On Sun, 23 Mar 2025, Laurenz Albe wrote: > On Thu, 2025-03-20 at 23:48 +0100, Dimitrios Apostolou wrote: >> Performance issues: (important as my db size is >5TB) >> >> * WAL writes: I didn't manage to avoid writing to the WAL, despite havi= ng >> =C2=A0=C2=A0 setting wal_level=3Dminimal. I even wrote my own function = to ALTER all >> =C2=A0=C2=A0 tables to UNLOGGED, but failed with "could not change tabl= e T to >> =C2=A0=C2=A0 unlogged because it references logged table".=C2=A0 I'm ou= t of ideas on this >> =C2=A0=C2=A0 one. > > You'd have to create an load the table in the same transaction, that is, > you'd have to run pg_restore with --single-transaction. That would restore the schema from the dump, while I want to create the schema from the SQL code in version control. Something that might work, would be for pg_restore to issue a TRUNCATE before the COPY. I believe this would require superuser privelege though, that I would prefer to avoid. Currently I issue TRUNCATE for all tables manually before running pg_restore, but of course this is in a different transaction so it doesn't help. By the way do you see potential problems with using --single-transaction to restore billion-rows tables? Thank you, Dimitris --0-390209832-1742826258=:1515035--