Re: Updating a large table

2018-01-09 Thread Timokhin Maxim
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

Re: Updating a large table

2018-01-09 Thread Timokhin Maxim
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

Updating a large table

2017-12-22 Thread Timokhin Maxim
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