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 1u026L-00AMEW-KI for pgsql-general@arkaria.postgresql.org; Wed, 02 Apr 2025 17:42:09 +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 1u026I-00Gi8v-H2 for pgsql-general@arkaria.postgresql.org; Wed, 02 Apr 2025 17:42:06 +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 1u026I-00Gi8n-63 for pgsql-general@lists.postgresql.org; Wed, 02 Apr 2025 17:42:06 +0000 Received: from mout.gmx.net ([212.227.17.22]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u026G-0030nn-0N for pgsql-general@lists.postgresql.org; Wed, 02 Apr 2025 17:42:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1743615722; x=1744220522; i=jimis@gmx.net; bh=LkT0spd+U6HPLzAFNh2by04pGeXmC9CllvwOYIHLBqw=; 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=LDgNjWB2Ek8q0Jg8MZOdTRBxje/PSORdSKyolz456nVBCphWPUmvNudgTHkMy7Oh vxTFNdEhcksoFzTOW9AayIgXLwWJxNy2NwP22YHObNLt3Wi2o2fA0N9xEQPsRwtCl +Oym7Ozq9+/fga0kBisl4PvE7MvaIFoiNU6fnmrcF8/z479aY/R7IQ63V+sBGusUd 4ThWsOBpZaC6ilIGb1adXAykX0PGz7lQne70UluIeeSZNsF7oRNsxWgUlokFyPdr+ RXitr69cugAX9VYHVshojvV+7UXGhwz8lEi/QmfFiXK0578P4F15/imvS08jQeO2k /6x0/dfT87tc8uCnWQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [10.9.70.81] ([185.55.106.54]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Ml6qC-1tEqIv40Nw-00jEfJ; Wed, 02 Apr 2025 19:42:02 +0200 Date: Wed, 2 Apr 2025 19:42:01 +0200 (CEST) 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: <7e315548-805d-0c11-e143-acdcff8660e5@gmx.net> References: <53760c70-4a87-a453-9e02-57abc9cb2e54@gmx.net> <455d28421ae33c73b73a6f527d2f72816ca5dd29.camel@cybertec.at> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="0-336073191-1743615722=:139110" X-Provags-ID: V03:K1:3PaDvzAvF1gtAt3N9e4XuUd0IxJFEn2IcDvjFeweTEprP6gGvcT NmFIVfsmM+DCLb6VEiOMiurdhNLohE0sXat40N23elaGzJXksorGIuBUF/lhuI952F1i+y3 3fYjaLehWBHAT6F6Cqrg4Y2nqh4XwBAEpxzNrAhwGtISky+l4xpQ/fAXGv+TKwzr6aeRXUD JGWunQx9SFwU5GndFJXyw== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:yNMeB9KHsPA=;4L/6KuwGYMMYEab2OxeP4+VVHfk bfLnyPVH/NTi8yHjiPzOePFEczcoxB3J/E288ionepuyvhtOQbRmq8qQ1QRC1+TbExnV/tqLx 96ZYv5Hz5BBpHguIBKIgSdNhEf2+/nNgDKlO/i87rwl4PM8CS9z4NK2Tvmfn9hhyAnrQRwjwM 7jEl87xgAOamOqyfg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pBpk/zN8s37n1VTg LLoTML8o9gKzX5igLM//6WbntlqHZ3rRsH6YZASW1Gm+KSTHcpr4GACLF6h3bEsm4BG1iYCb8 zRjXmYYqVlUiIHjTBoyawDQe878Lpk+P7D2l4IylvTIYBEgQH6IJxJWwvZv77Ari0BC4hzhQR ZvpEidzDQkB3fYhd9XKrH3b5EezOPLhbGMRbuBpMxQ96GAUz1Bl3p/8fO1ZYGhGy0EaZrSfPj 0umSiLQ== 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-336073191-1743615722=:139110 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Hi Laurenz, 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. Do you know why --single-transaction can't be combined with -j ? I'm thinking it's because every process would need to have its own transaction, which apparently results to more than one transaction. Do you think this could be alleviated somehow with subtransactions? I'm trying to think of a way to enjoy the performance benefits of =2D-single-transaction, while also parallelizing the pg_restore. For this use case I don't care about the content appearing all in one transaction. Would it be possible then to have dependency resolution in such a way that we split the tasks into one transaction per worker process? Just thinking out loud here, I'd be interested in feedback. Thanks, Dimitris --0-336073191-1743615722=:139110--