From: Daniel Verite <daniel@manitou-mail.org>
To: Mohamed Wael Khobalatte <mkhobalatte@grubhub.com>
Cc: Michael Lewis <mlewis@entrata.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: Switching Primary Keys to BigInt
Date: Wed, 22 Jul 2020 15:27:08 +0200
Message-ID: <029f54d9-99ec-49d2-b8eb-567bf6b4f3ce@manitou-mail.org> (raw)
In-Reply-To: <CABZeWdwsaMvjU7ECLKpAr5WZVp+5LS7NAcqhzg1KHkFHQQr1xQ@mail.gmail.com>
Mohamed Wael Khobalatte wrote:
> > alter table change_seq alter COLUMN id set data
> > type bigint;
> This is significant downtime, since it locks exclusively, no? We want to
> avoid that.
Well, in the steps you mentioned upthread, the transaction starts by
doing LOCK TABLE some_table, so it will hold an exclusive lock on it
for the rest of the transaction.
If you can test how the ALTER TABLE... SET TYPE ... compares
to your procedure in terms of downtime, that would be interesting.
To me, it's not clear why the procedure in multiple steps would
be better overall than a single ALTER TABLE.
Best regards,
--
Daniel Vérité
PostgreSQL-powered mailer: https://www.manitou-mail.org
Twitter: @DanielVerite
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: daniel@manitou-mail.org, mkhobalatte@grubhub.com, mlewis@entrata.com
Subject: Re: Switching Primary Keys to BigInt
In-Reply-To: <029f54d9-99ec-49d2-b8eb-567bf6b4f3ce@manitou-mail.org>
References: <CABZeWdwsaMvjU7ECLKpAr5WZVp+5LS7NAcqhzg1KHkFHQQr1xQ@mail.gmail.com> <029f54d9-99ec-49d2-b8eb-567bf6b4f3ce@manitou-mail.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox