On Thu, Feb 13, 2025 at 10:40 AM Adrian Klaver <adrian.klaver@xxxxxxxxxxx> 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,