Non blocking type change for primary column

Поиск
Список
Период
Сортировка
От Torge Kummerow
Тема Non blocking type change for primary column
Дата
Msg-id 9c0ebcd1-92f3-3b51-0a3d-68195f6aec21@panaccess.com
обсуждение исходный текст
Ответы Re: Non blocking type change for primary column
Список pgsql-sql
Hi,

I wonder if there is a feature planned (or already available in 11+)
that allows one to change the column type of a table without making it
block until finished.

As seemingly many others, we used serial instead of bigserial in our
tables and some will at a not too distant future hit their limit.

I am currently evaluating our options. One, that seems possible would be

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?

Greetings,
    Torge.




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

Предыдущее
От: Philip Semanchuk
Дата:
Сообщение: Re: how to make query
Следующее
От: Guillaume Lelarge
Дата:
Сообщение: Re: Non blocking type change for primary column