Re: add column with default value is very slow

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: add column with default value is very slow
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C2086255D3@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на add column with default value is very slow  (AI Rumman <rummandba@gmail.com>)
Список pgsql-performance
AI Rumman wrote:
> I execued the query:
> ALTER TABLE entity ADD COLUMN owner_type char(1) NOT NULL default 'U';
>
> The db is stuck. The enity table has 2064740 records;
>
> Watching locks:
[all locks are granted]

> Any idea for the db stuck?

To add the column, PostgreSQL has to modify all rows in the table.

But then 2064740 records is not very much, so it shouldn't take forever.

Do you see processor or I/O activity?

Yours,
Laurenz Albe


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

Предыдущее
От: AI Rumman
Дата:
Сообщение: add column with default value is very slow
Следующее
От: hubert depesz lubaczewski
Дата:
Сообщение: Re: add column with default value is very slow