Re: add column with default value is very slow

Поиск
Список
Период
Сортировка
От AI Rumman
Тема Re: add column with default value is very slow
Дата
Msg-id CAGoODpeorc_7U57NYKsf68Gd3wi9VM+=2kJDZ=89Tk=J=XE=pg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: add column with default value is very slow  (hubert depesz lubaczewski <depesz@depesz.com>)
Ответы Re: add column with default value is very slow  (hubert depesz lubaczewski <depesz@depesz.com>)
Re: add column with default value is very slow  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-performance
I added the excel file for locks data.
I was surprised to see that while I was updating a single column value for all records in a tables, all indexes are locked by the server.

On Tue, Sep 11, 2012 at 7:44 PM, hubert depesz lubaczewski <depesz@depesz.com> wrote:
On Tue, Sep 11, 2012 at 07:20:28PM +0600, AI Rumman wrote:
> I have a table as follows:
> 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;

such alter table has to rewrite whole table. So it will take a while

> Watching locks:

output of this was perfectly unreadable, because your email client
wrapped lines at some random places.

In future - please put such dumps on some paste site, or just attach it
to mail, and not copy/paste them to body of message.

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/

Вложения

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

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