Re: Switching Primary Keys to BigInt

Поиск
Список
Период
Сортировка
От Mohamed Wael Khobalatte
Тема Re: Switching Primary Keys to BigInt
Дата
Msg-id CABZeWdxCGX-WsrV+Cbz5f4L5UqxFoa_agKzCOrP5=6otpCEDZA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Switching Primary Keys to BigInt  ("Daniel Verite" <daniel@manitou-mail.org>)
Ответы Re: Switching Primary Keys to BigInt  (Michael Lewis <mlewis@entrata.com>)
Список pgsql-general


On Wed, Jul 22, 2020 at 11:13 AM Daniel Verite <daniel@manitou-mail.org> wrote:
        Mohamed Wael Khobalatte wrote:

> We lock the table as a precaution, with the understanding that we are
> undergoing a "small" downtime to finish replacing the int id by the new
> bigint

Ah, sorry I overlooked that most row updates are done
pre-transaction in a preliminary step:
  /* in batches, we update all the rows to new_id = id */

No worries. I suppose the answer to the original question, which is how to avoid a table scan when adding a primary key constraint to a newly backfilled column is "there is no way"? Downtime might be at least as long as the table scan.

В списке pgsql-general по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Transaction control in SECURITY DEFINER procedures
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Doubt in mvcc