Re: What is the best way to create Primary Key on a large table in Postgresql 9.5?

Поиск
Список
Период
Сортировка
От Feike Steenbergen
Тема Re: What is the best way to create Primary Key on a large table in Postgresql 9.5?
Дата
Msg-id CAK_s-G1-k0yQ-HAO+LDR7MFTbRT1vJmq-dYFrLqfiEBB8zET3g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: What is the best way to create Primary Key on a large table in Postgresql 9.5?  (Ravi Tammineni <rtammineni@partner.aligntech.com>)
Список pgsql-admin
What we would do when having to update a large table is do it in multiple transactions. Basically:

1. create sequence s1;
2. alter table t1 add column c1 integer default nextval('s1'); -- Ensure new values don't need changing anymore
3. In batches of a significant but not huge amount of rows: update t1 set c1=nextval('s1');
4. Create index
5. Convert the index into pk index

We use niceupdate (home brew tool) for this, it may suit your needs:

Regards,

Feike

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: pg_upgrade question
Следующее
От: koffi BADOH
Дата:
Сообщение: tools to centralize postgreSQL account management