Re: add column with default value is very slow - Mailing list pgsql-performance

From Albe Laurenz
Subject Re: add column with default value is very slow
Date
Msg-id D960CB61B694CF459DCFB4B0128514C2086255D3@exadv11.host.magwien.gv.at
Whole thread Raw
In response to add column with default value is very slow  (AI Rumman <rummandba@gmail.com>)
List 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 by date:

Previous
From: AI Rumman
Date:
Subject: add column with default value is very slow
Next
From: hubert depesz lubaczewski
Date:
Subject: Re: add column with default value is very slow