Re: Non blocking type change for primary column

Поиск
Список
Период
Сортировка
От Mohamed Wael Khobalatte
Тема Re: Non blocking type change for primary column
Дата
Msg-id CABZeWdxsitbHGhj2PahAc64HnB-BD7i3njok8gwh7FV_4Bft6A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Non blocking type change for primary column  (Guillaume Lelarge <guillaume@lelarge.info>)
Список pgsql-sql
1. adding a new nullable column of type bigint.
2. copying the primary key into this field in small batches
3. Once done. rename the primary column and new column, to swap them
4. attach the sequence to the new column and deattach it from the old column
5. Make new column NON NULL (Not sure if this will block)
6. Remove primary key from old column, make new column to be the primary
key (I fear this will block to create the index, but I guess not nearly
as long as ALTER COLUMN type)
7. Delete old column.

This could be prevented, if this would be done in a non blocking way by
the database system itself, so I hope this is already implemented or at
least on the roadmap.
Any thoughts?

Hye Torge,

I was recently involved with such a change. See this thread[1]  for discussion. In particular, it touches on point 5, where you ask what's blocking. Hope it helps. 

[1] https://www.postgresql.org/message-id/flat/CABZeWdybDVTgCQFZf0jDtj0p4yLxNrYd8aw61iFxY-Xt%2BfqPkw%40mail.gmail.com

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

Предыдущее
От: Guillaume Lelarge
Дата:
Сообщение: Re: Non blocking type change for primary column
Следующее
От: Roberto Médola
Дата:
Сообщение: Bring to dead tuples to alive