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 1tvhcK-007FFX-HB for pgsql-general@arkaria.postgresql.org; Fri, 21 Mar 2025 19:01:16 +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 1tvhcJ-00DvIJ-2K for pgsql-general@arkaria.postgresql.org; Fri, 21 Mar 2025 19:01:15 +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 1tvhcI-00DvIB-O5 for pgsql-general@lists.postgresql.org; Fri, 21 Mar 2025 19:01:14 +0000 Received: from mail-oo1-xc36.google.com ([2607:f8b0:4864:20::c36]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tvhcG-000Mxt-1T for pgsql-general@lists.postgresql.org; Fri, 21 Mar 2025 19:01:14 +0000 Received: by mail-oo1-xc36.google.com with SMTP id 006d021491bc7-5fe86c16f5dso1072441eaf.1 for ; Fri, 21 Mar 2025 12:01:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1742583670; x=1743188470; darn=lists.postgresql.org; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :from:to:cc:subject:date:message-id:reply-to; bh=fI0OpBPBAuV5k1NmwHmoZVWPMIF7AFT0dcP3xs2DwAo=; b=i7Dd5sLZgXSGdGRrKid8SGqthnVctmOItar3Ner6MWqicrDPL3kMu+B856rhSzS4n2 S1hhngZC+wTOs80079yy9ye7E98NQg2sKufWe6euVnHxuSo02VA6clbcnjnu8xnRx3a/ F08hvOAg/MG9L3jJhb93GeAgM+C0c3a03xuPl3PSv1Ix9JBcjvT/Ht71c+2qOcUoA3w+ V+rIZpx3xSxXZYz1FYrsQkD9QIMJfU11woJnXY4K3EP1dW+f/fKkEl7+XvZv8OB1YPG2 7oowUaHUgw4Mm0kp09GPJJX0LFOyXHFivH418KfgTFdrFewexsYt2yp+Zh+VESK1/8TT Rv6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742583670; x=1743188470; h=to:subject:message-id:date:from:in-reply-to:references:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fI0OpBPBAuV5k1NmwHmoZVWPMIF7AFT0dcP3xs2DwAo=; b=kvf/5DkaWn0SnlnKBfOmk5cEYItzgSjrFJWIVV0lfuurJsLqoGj5UZGO15BNiZG6BP SJePdpiXPq/wi2hNsZxhgIRdcOtbjX6QIKRYGQ5NFS487JJ/+VI7fsv5SI1ZJc6VPGjm 9ek6Kyc1oEC3ztYOwxEJp8O7rOZRsAw3wWx5xZ+Q3Zv2w51q8MbQxWGblcI5LPS7HdSl XlSI/N98nelkwshphdYbYZ16ZvFGWHh+8IFG3Di0keIbzxrofcbGT+IDn7cClkLI2bdl 9RaKUTaTsZvSIYNy5HrwDe5MMqoVGioRrZAP73eb7rA7M/JBgx6fjnBNTyx2C9wrpwbj mm9g== X-Gm-Message-State: AOJu0YzJaceT1JOnMmRC/NYvMvMJ9HVOoK+eyNlshNNbKN/utvTIZYK7 6/Eui6xtnQrI6YG/cq6EPFxRDXJvSnjayxQ7Fwpd+PV/6ioMuE/S9tZ/QIvEKJrxxsLrTZ7MipY YzjG1gK9S7RGiCQCKEccVBF7gVCot+YeK X-Gm-Gg: ASbGncuk1+pvRrKJnefF95vPtVI3TS2ywQTxtBLZtZKX2GLddHUXDMLsiHSzp+IJhz7 Y/XFWEU2uv0/s8FrrNMDm5sMNpw2zJomlVIKEAM/8Xrh+IXRxlmut0ibxQXfM1tX+9l9PvVbMNr 9rRkbjYBS8g9+oEGacCQS0K4RUeCzCNZeYQfHmdCUOmcHBy24TNSh7tPDaDcsG X-Google-Smtp-Source: AGHT+IGezEqyT1zWqKzD+2QPIC6nmGA4mRj3jQVxM5jQbVD+G7+xr67cwkcpg23xBxUz3Ov8QOoUW6A0G8JqM6PDY3g= X-Received: by 2002:a05:6820:418e:b0:601:d224:5213 with SMTP id 006d021491bc7-60234486a24mr2222522eaf.1.1742583668457; Fri, 21 Mar 2025 12:01:08 -0700 (PDT) MIME-Version: 1.0 References: <53760c70-4a87-a453-9e02-57abc9cb2e54@gmx.net> <756f3204-5cb9-5c7e-642c-bc5ec78db59d@gmx.net> In-Reply-To: <756f3204-5cb9-5c7e-642c-bc5ec78db59d@gmx.net> From: Ron Johnson Date: Fri, 21 Mar 2025 15:00:57 -0400 X-Gm-Features: AQ5f1Jpkyj4DB1e7mc15JOIsmBxJcng7MXaAMalixSKWsAyZSSUPeLI98P9J4mk Message-ID: Subject: Re: Experience and feedback on pg_restore --data-only To: "pgsql-generallists.postgresql.org" Content-Type: multipart/alternative; boundary="0000000000008cd0040630dee086" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000008cd0040630dee086 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 21, 2025 at 2:36=E2=80=AFPM Dimitrios Apostolou = wrote: > On Thu, 20 Mar 2025, Dimitrios Apostolou wrote: > > > Rationale: > > > > When restoring a backup in an emergency situation, it's fine to run > > pg_restore as superuser and get an exact replica of the dumped db. > How often do you have emergencies requiring database restore???? In my seven years managing PG systems, I've had TWO. > > AFAICT pg_restore (without --data-only) is optimised for such case. > [snip] > > Any feedback for improving my process? Yes: don't use a logical backup tool like pg_dump to backup production databases. PgBackRest (the tool I have experience with; there are others, though) has mandatory features like PITR, incremental and differential backups, delta restores and encryption. Use that instead. To get rid of the cruft in your database, go through the schema and manually drop unused tables. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --0000000000008cd0040630dee086 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Mar 21, 2025 at 2:36=E2=80=AFPM D= imitrios Apostolou <jimis@gmx.net&g= t; wrote:
On Thu, 20 Mar 2025, Dimitrios Apost= olou wrote:

> Rationale:
>
> When restoring a backup in an emergency situation, it's fine to ru= n
> pg_restore as superuser and get an exact replica of the dumped db.
=

How often do you have emergencies requirin= g database restore????=C2=A0 In my seven years managing PG systems, I'v= e had TWO.
=C2=A0
> AFAICT pg_restore (without --data-only) is optimised for such case.
=C2=A0[snip]
> Any feedback for improving my process?
Yes: don't use a logical backup tool like pg_dump to backu= p production databases.

PgBackRest (the tool = I have experience with; there are others, though) has mandatory features li= ke PITR, incremental and differential backups, delta restores and encryptio= n.=C2=A0 Use that instead.

To get rid of the= cruft in your database, go through the schema and manually drop unused tab= les.

--
Death = to <Redacted>, and butter sauce.
Don't boil me, I'm still= alive.
<Redacted> lobster!
--0000000000008cd0040630dee086--