today I need to alter one of our biggest tables to add two new columns
with default value 0.
Server version: PostgreSQL 9.5.4 on x86_64-slackware-linux-gnu, compiled
by x86_64-slackware-linux-gcc (GCC) 5.3.0, 64-bit
when I do: ALTER TABLE stocks ADD COLUMN promo INTEGER DEFAULT 0;
long waiting is coming, so I try to find a way how to avoid that
waiting. I know isn't possibly to alter table without lock it,
but Im wondering do will be more fast if I do:
ALTER TABLE stocks ADD COLUMN promo INTEGER;
UPDATE TABLE stocks SET promo = 0;
ALTER TABLE stocks ALTER COLUMN promo SET DEFAULT 0;
Unfortunately I can't test on product servers, so Im looking for some
advice or some one to point me the right direction how I can alter table
today without clients to notice their query is locked and need to wait.
Sent via pgsql-general mailing list (firstname.lastname@example.org)
To make changes to your subscription: