Re: Best Approach for Swapping a Table with its Copy

From: Greg Sabino Mullane <htamfids(at)gmail(dot)com>
To: Marcelo Fernandes <marcefern7(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, Dominique Devienne <ddevienne(at)gmail(dot)com>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Best Approach for Swapping a Table with its Copy
Date: 2025-02-14 15:11:48
Message-ID: CAKAnmmJ0=9m3gXvjvWVAbyJpU=Uopn1K5sQDOPWJG7GNRctPmg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 13, 2025 at 6:06 PM Marcelo Fernandes <marcefern7(at)gmail(dot)com>
wrote:

> > It's technically possible to do something similar for your use case, but
> 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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2025-02-14 15:14:45 Re: Best Approach for Swapping a Table with its Copy
Previous Message Achilleas Mantzios - cloud 2025-02-14 10:46:22 Re: Ideas about presenting data coming from sensors