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 1tixMk-004Cmd-JM for pgsql-general@arkaria.postgresql.org; Fri, 14 Feb 2025 15:12:30 +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 1tixMi-00B4wi-Il for pgsql-general@arkaria.postgresql.org; Fri, 14 Feb 2025 15:12:29 +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 1tixMi-00B4wZ-8H for pgsql-general@lists.postgresql.org; Fri, 14 Feb 2025 15:12:28 +0000 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tixMg-000oui-23 for pgsql-general@lists.postgresql.org; Fri, 14 Feb 2025 15:12:28 +0000 Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-3ce76b8d5bcso18041485ab.0 for ; Fri, 14 Feb 2025 07:12:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739545945; x=1740150745; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=kXV2ZOQ9ALSPAVmRbkoz7AKLoVVmOWw4NWyJ6fMkmB0=; b=GqwFO70moQoM+xqEbmEmvizvSLxNzO9dIwZVJksZ2Dl/p6G0HkDv5no1+gT131PgTA u7Ba7J/HEt5OrwgOfUeV1GZTZ1R4Qm5jmIx8eGa1+l6LyARTWi3DCDU12TshqN2ugyYR 1OeOl6GWiRlIrZEGrZ/vQ+F8ReGy6jqnXxp+Y5eyEIjyS6jZqMvyNhviScxYMCPl4xPd HXbOPSGljkCxtj+SOEXyvLxtQkQgJvJNMC0NRv2m2ODEqR2IDLwqgiG7u+L5PfCpz5Lv Y7qdx7SOhHLBU8rx66wqdu1RCVBqRYu8gBrz606/f0QMi2QZ6Pb4irwTkAn6XkDwSjEM TsZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739545945; x=1740150745; h=cc: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=kXV2ZOQ9ALSPAVmRbkoz7AKLoVVmOWw4NWyJ6fMkmB0=; b=Yi2SoMQrw8v+F2ocw/Fe4bYDNf09Fcxqypt+Bbmts9YFo5qTvHGC1q3nMFLafP3Guk wpelAwFiXk7a7ZCNAUpFnYEa3/aFyPWitZv4op7PlDXBcS1FC1XyM+37/lUfq4OZEc0g suuTjRgJLtY3IW7AYV5gQNpymk3RE+vdvkN29DdNxsVjC7oCBZuj31P/2nkZXT8tY97m B9JnWGYxDmrT1mbrznIrj94/xwnae/cv4VCe6EOaLKR4iE/ShzTtC8DvztnZ/cYGO4UM u8M3xLGruW+xpLErHKgoCbWmM+LOjrMRZ7SyFKEUU/nIjBWacTrruXwzCgvktvA3iOtO XEJA== X-Forwarded-Encrypted: i=1; AJvYcCUkJiyjpWFYFc5x6zy302kFw1tUa1N8hyQvr2C24+fn1u2ukIOjpnAN215rom/8/kazWE545Ci3k1tSTpNO@lists.postgresql.org X-Gm-Message-State: AOJu0YyVJBlrf0W+oIsweXjeYV1ggr8t4Ph0p0HxWmBxyBgWWJ3DOkJa YxKtAuzDGI0y7BXaCBdqvej1Vygmnr2GMgYyyf8cIDwOB4hnGW/V3cq6ndkqj6xkxIYQk4Xh/69 0zcHJjJfG2gzkpP2qnkYVCwAjuks= X-Gm-Gg: ASbGncu3oRd2vClfAWWSBfdISe/6HCcwQSw0MEhWvcB2iAlEalYbytboqfgO0otB3QK ulQcrHMAmOm6+aGeeITB+L+v0MMrWj4l8vXJ72vyyk4tre9yGTPF/oXzp7oix7TR7K2AP8u1/JH T55AM3M0z7sdvixw5sJ+yBm0rZcCh+WAA= X-Google-Smtp-Source: AGHT+IFqpHXZ4KjHPT1O8+rsKt9vc7W4JtwoaahaClds68pIAff+8Yq6JHBNEpGOdef5cQPhoSrdnH04KewF6nTgGdY= X-Received: by 2002:a05:6e02:1d01:b0:3d1:9fd2:d9cd with SMTP id e9e14a558f8ab-3d19fd2dc24mr15472905ab.9.1739545943768; Fri, 14 Feb 2025 07:12:23 -0800 (PST) MIME-Version: 1.0 References: <8ac6a1dd-db82-4ea7-8186-0c354d79049f@aklaver.com> <9fa75099-1ee9-43de-ac6e-945841b184eb@aklaver.com> <22406cdf-83f5-4b98-b07e-7827afe97f93@aklaver.com> <94e1205e-8ddf-403b-8477-02d7939f2905@aklaver.com> In-Reply-To: From: Greg Sabino Mullane Date: Fri, 14 Feb 2025 10:11:48 -0500 X-Gm-Features: AWEUYZmZdoUzE8ZnPsDX0Coegl3shi_HRnn10B7is5Iatns8fcgCU-nXgHCJnGE Message-ID: Subject: Re: Best Approach for Swapping a Table with its Copy To: Marcelo Fernandes Cc: Adrian Klaver , Dominique Devienne , pgsql-general@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000000c8a18062e1b9ab0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000c8a18062e1b9ab0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 13, 2025 at 6:06=E2=80=AFPM Marcelo Fernandes wrote: > > It's technically possible to do something similar for your use case, bu= t > it's not trivial. All the cab to trailer wires must be precisely changed. > Everything directly related to the data must be swapped: heap, indexes, > toast. > > I'd really appreciate to know more about how I can do this, as I think > this is > the crux of what I am trying to solve. > The pg_repack link posted earlier has the details on how it is done. But messing with system catalogs like this is highly discouraged, for good reasons. Still, if you need to go that route, test heavily and post the solutions here for feedback. Cheers, Greg -- Crunchy Data - https://www.crunchydata.com Enterprise Postgres Software Products & Tech Support --0000000000000c8a18062e1b9ab0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Feb 13, 2025 at 6:06=E2=80=AFPM M= arcelo Fernandes <marcefern7@gma= il.com> wrote:
> It's technicall= y possible to do something similar for your use case, but it's not triv= ial. All the cab to trailer wires must be precisely changed. Everything dir= ectly related to the data must be swapped: heap, indexes, toast.

I'd really appreciate to know more about how I can do this, as I think = this is
the crux of what I am trying to solve.

= The pg_repack link posted earlier has the details on how it is done. But me= ssing with system catalogs like this is highly discouraged, for good reason= s. Still, if you need to go that route, test heavily and post the solutions= here for feedback.

Cheers,
Greg

--
Enterprise Po= stgres Software Products & Tech Support

--0000000000000c8a18062e1b9ab0--