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 1uW9Ei-008vI0-GO for pgsql-admin@arkaria.postgresql.org; Mon, 30 Jun 2025 07:47:32 +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 1uW9Eg-00F21L-K2 for pgsql-admin@arkaria.postgresql.org; Mon, 30 Jun 2025 07:47:31 +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 1uW9Eg-00F21D-8Y for pgsql-admin@lists.postgresql.org; Mon, 30 Jun 2025 07:47:30 +0000 Received: from mail-oo1-xc2c.google.com ([2607:f8b0:4864:20::c2c]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uW9Ef-004ixK-0d for pgsql-admin@lists.postgresql.org; Mon, 30 Jun 2025 07:47:29 +0000 Received: by mail-oo1-xc2c.google.com with SMTP id 006d021491bc7-606668f8d51so2213269eaf.0 for ; Mon, 30 Jun 2025 00:47:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1751269648; x=1751874448; 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=Jzkeey01QMeVbmtffxzS+KKL385BO7TtDtNkcrdrYVM=; b=gx0mggyQ8XD7xJW4zcrtI+IAXEsa9EHPj0+jJ1rY948luSNAMK/HFr9S+HBwxRhgUM kz1lMin9KM996YlPZlionz0blI/zU98E9v642qShrPvKgiaWqigUgKtyiaJmxy9Q1pnj KLCaLbH/lX1ElUb/Jf1PVHVPSeltEGbmlOJrjsxk0pYeQUZe6bDc1rt20SyYvue93IbD fTRjVQfrlLlnFO4l7qvZzoy09hQkGjBZLl75M7xWHug8ZXBRjTOPh06n0HIeiI6SorN7 ASUWQXjaqi75h2U8IFwSUgza3FzuZEdc0gjF6K3HvZj0mswtmUjlgaM+/cqT2qpSZbUV Y73Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751269648; x=1751874448; 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=Jzkeey01QMeVbmtffxzS+KKL385BO7TtDtNkcrdrYVM=; b=QmLIMbI4az88Y1W7ywH7/S36dBmpsP4cl8io2tWfPjeeQyzL85VEe0CjT8COLfovh2 JLpaAwnZ25im/7pFo/R3S7UndYAM0oZO/1CzzAx3/WMeg5zt5mmXj3whesVLiNA6z9Vx L8i6/fz2rvnLep12kRHu3/bhFXPzen4snU+y/iP8RuF6aDa7gRQDu1iFWNkqJWIv3qNC QPZa9Q15t7QBGU7PGXRIXIg87SItvzNkfB08mKKpSPUHQfIKazL2wnttE2gar519vBvx db2290tiVA2f8HrW7Yeki4oNWtb5FFsNFHsXOidENtV9ItgBUu11VV74wuFtDqEaXg6c 8pgQ== X-Gm-Message-State: AOJu0YxmPFVE/FpDVmPYYvYTfERJD2kuhTSfdmS+EadaZHIRHk+KpSFu mfA4LM/1vsoaAXE8npAhwlCL39deqWeTRlAk7WRDiRsj/6d/1X69IMhMaFxpwC2SjX5RCCVQgam krrU6wByxjQudmVJdgMgEdDfjLt+6baXGhc8r X-Gm-Gg: ASbGnctDCM2Du19rBHtYaoMVWgz7/84k9xKmesEMp8AsoOoFwVb8Jm9gUWfATSv0PMJ wWMUGaiDqtZi6RVCreNX+VP2eCzsBZJPp9d12tDNdtdvOlc5iHvl2C/1xm6MRDY+v+U+kJnp54B 3DOAUgCKshNsblh7ut7AYT0PDy6z0Iu4yqAys/SLHFPsFB9Ki3x8jYFplt5Qx5zkP5zUBhj2Tlw TBAug== X-Google-Smtp-Source: AGHT+IGX/SXPMrlqcAbJ+gd0NpD5McuS975t7chnLb4wST64Y4+FhsDbiReX3sYpj5rUs7JHNB50wZsLbvW6do8iS/M= X-Received: by 2002:a05:6820:178f:b0:611:a5f4:42c0 with SMTP id 006d021491bc7-611b98b0fffmr8657816eaf.2.1751269648108; Mon, 30 Jun 2025 00:47:28 -0700 (PDT) MIME-Version: 1.0 References: <7bcef1b5-6e29-4eea-8c85-23a80dab4e2c@cloud.gatewaynet.com> In-Reply-To: <7bcef1b5-6e29-4eea-8c85-23a80dab4e2c@cloud.gatewaynet.com> From: Ron Johnson Date: Mon, 30 Jun 2025 03:47:17 -0400 X-Gm-Features: Ac12FXxtk2nqCKVg08bvR6qDG6UtEo5RGLjkW1LIZjmMYc5cYCAacAC78mDAGpE Message-ID: Subject: Re: Fast Logical replication setup, via VM clone , PostgreSQL 16.9 To: Pgsql-admin Content-Type: multipart/alternative; boundary="0000000000004813dc0638c53d40" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000004813dc0638c53d40 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Mon, Jun 30, 2025 at 3:36=E2=80=AFAM Achilleas Mantzios < a.mantzios@cloud.gatewaynet.com> wrote: > Hi, > > I gotta provide again a logical repl subscriber for our devs, we are > running PostgreSQL 16.9 . > > Instead of going the traditional logical replication way (which involves > long running COPY, catchup, etc), I am thinking of doing something along > the lines : > > 1) @publisher (master) create repl slot, create publication > > 2) shutdown postgresql , > > 3) clone the VM, > "We" (not me, but the ESX Admin team) takes a snapshot of the VM (including all mount points) every day. About 5 years ago, "OMG we dropped a table, and need it restored ASAP, but can't stop other production." Because we use PgBackRest, it's not possible to restore one table in one database, and since it's a 5TB instance, restoring to a new disk would take time. The simplest solution was to restore the appropriate VM snapshot to a new VM. That worked like a charm. "pg_ctl start -wt9999" on the new VM recovered all open transactions, and I could access the relevant table. IOW, you might just need to: 1) Take a snapshot of the primary VM. 2) Restore that snapshot to a new VM. It's not too dissimilar from a crash and restart. --=20 Death to , and butter sauce. Don't boil me, I'm still alive. lobster! --0000000000004813dc0638c53d40 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Jun 30, 2025 at 3:36=E2=80=AFAM A= chilleas Mantzios <a.= mantzios@cloud.gatewaynet.com> wrote:
H= i,

I gotta provide again a logical repl subscriber for our devs, we are
running PostgreSQL 16.9 .

Instead of going the traditional logical replication way (which involves long running COPY, catchup, etc), I am thinking of doing something along the lines :

1) @publisher (master) create repl slot, create publication

2) shutdown postgresql ,

3) clone the VM,

"We" (= not me, but the ESX Admin team) takes a snapshot of the=C2=A0VM (including = all mount points) every day.

About 5 years ago, &q= uot;OMG we dropped a table, and need it restored ASAP, but can't stop o= ther production."

Because we use PgBackRest, = it's not possible to restore one table in one database,=C2=A0and since = it's a 5TB=C2=A0instance,=C2=A0 restoring to a new=C2=A0disk would take= time.=C2=A0 The simplest solution was to restore the appropriate VM snapsh= ot to a new VM.

That worked like a charm.=C2=A0 &q= uot;pg_ctl start -wt9999" on the new VM recovered all open transaction= s, and I could access the relevant table.

IOW, you= might just need to:
1) Take a snapshot of the primary VM.
<= div>2) Restore that snapshot to a new VM.

It's= not too dissimilar from a crash and restart.

--
Death to <Redacted>, and butter sauce.Don't boil me, I'm still alive.
<Redacted> lo= bster!
--0000000000004813dc0638c53d40--