Hello, Sergey!
09.01.2018, 15:53, "Sergei Kornilov" :
> Hello
>
>> 1. ALTER TABLE clusters ADD COLUMN "is_paid" BOOLEAN DEFAULT FALSE;
>
> this is wrong. To avoid large table lock you need DEFAULT NULL:
> ALTER TABLE clusters ADD COLUMN "is_paid" BOOLEAN DEFAULT NULL;
> Default null changes only
Hello Tomas! Thank you for the useful answer!
23.12.2017, 23:58, "Tomas Vondra" :
> On 12/22/2017 05:46 PM, Timokhin Maxim wrote:
>> Hello! We have a large table 11GB ( about 37 million records ) and we
>> need to alter a table - add a new column with default value
Hello! We have a large table 11GB ( about 37 million records ) and we need to
alter a table - add a new column with default values is false. Also 'NOT NULL'
is required.
So, first I've done:
ALTER TABLE clusters ALTER COLUMN "is_paid";
after that:
UPDATE clusters SET is_paid = DEFAULT where c