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 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 system catalog, default with any non-null value will rewrite all ro

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 values is >>  false. Also 'NOT NU

Re: Updating a large table

2017-12-23 Thread 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 values is > false. Also 'NOT NULL' is required. > > So, first I've done: > > ALTER TABLE clusters ALTER COLUMN "is_paid"

Re: Updating a large table

2017-12-23 Thread salah jubeh
Hello, Does the tale have foreign keys, if not you could create another table may be unlogged and then do the changes you want via INSERT ... SELECT; and finally convert the unlogged table to logged table.  In addition to that there are several ways to increase data writing performance for exam