public inbox for [email protected]
help / color / mirror / Atom feedFrom: Adrian Klaver <[email protected]>
To: Marcelo Fernandes <[email protected]>
Cc: [email protected]
Subject: Re: Best Approach for Swapping a Table with its Copy
Date: Wed, 12 Feb 2025 13:40:25 -0800
Message-ID: <[email protected]> (raw)
In-Reply-To: <CAM2F1VOOn1izCrtcrDx4YUtCY-H64Vj5yvN5H1Lhk8kCY+_W6Q@mail.gmail.com>
References: <CAM2F1VP9nn0F6fSjbmhJCNSjv-dbAJcAytZ2HkTkZ0dGYZvxrw@mail.gmail.com>
<[email protected]>
<CAM2F1VOOn1izCrtcrDx4YUtCY-H64Vj5yvN5H1Lhk8kCY+_W6Q@mail.gmail.com>
On 2/12/25 1:27 PM, Marcelo Fernandes wrote:
> On Thu, Feb 13, 2025 at 10:02 AM Adrian Klaver
> This is a simplified version of the original table:
>
> CREATE TABLE bookings (
> id SERIAL PRIMARY KEY,
> resource_id INT NOT NULL,
> start_date DATE NOT NULL,
> end_date DATE NOT NULL
> );
>
>> 3) The exclusion constraint definition.
>
> The copy table would have an exclusion constraint such as:
>
> ALTER TABLE bookings
> ADD CONSTRAINT no_date_overlap_for_resource_id
> EXCLUDE USING gist (
> resource_id WITH =,
> daterange(start_date, end_date, '[]') WITH &&
> );
Do you know this will not fail on the existing data?
>
>> 4) Definition of what 'fairly large' is.
>
> This table is over 400GB
Do you have room for a complete copy of the table?
>
> This is done to avoid having to hold an exclusive lock for a long amount of
> time, thus creating application outages.
I am not seeing how this can be done without some outage for that table.
What sort of time frame is acceptable?
>
> Hope that clarifies the situation a bit better
> - Marcelo
--
Adrian Klaver
[email protected]
view thread (8+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected]
Subject: Re: Best Approach for Swapping a Table with its Copy
In-Reply-To: <[email protected]>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox