From: | Marcelo Fernandes <marcefern7(at)gmail(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Best Approach for Swapping a Table with its Copy |
Date: | 2025-02-12 22:04:57 |
Message-ID: | CAM2F1VONo8M9gcybhmf8-CdmRUC2QrFGZkZLYF-+uLZuhRKaxQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Feb 13, 2025 at 10:40 AM Adrian Klaver
<adrian(dot)klaver(at)aklaver(dot)com> wrote:
> Do you know this will not fail on the existing data?
Yes, all the current data in the original table respects the constraint.
> Do you have room for a complete copy of the table?
Yes, in this scenario the copy is already created, and triggers keep the copy
in sync with the original table.
> I am not seeing how this can be done without some outage for that table.
Swapping tables without an outage is possible. I believe that this something
involved in the process repacking a table when using pg_repack as it relies on
copying the whole table and then swapping it for the original.
My main question is "How?". I know that the pg_repack involves swapping the
relfilenode values and something about TOAST tables, but I am not super
acquainted with pg_repack code or debugging tools to verify precisely what it
does.
> What sort of time frame is acceptable?
The scan phase in this table is very slow, on top of it the exclusion
constraint needs to create the underlying index to service the constraint.
Anything that takes more than 10s in this system is prohibitive, in this sense
creating the constraint without having a table copy is not viable for the size
of this table.
Regards,
From | Date | Subject | |
---|---|---|---|
Next Message | Ben Hancock | 2025-02-12 22:09:09 | Re: psql command line editing |
Previous Message | Adrian Klaver | 2025-02-12 21:40:25 | Re: Best Approach for Swapping a Table with its Copy |