Re: Adding a non-null column without noticeable downtime
От
Zev Benjamin
Тема
Re: Adding a non-null column without noticeable downtime
Дата
Msg-id
530CF317.8050804@strangersgate.com
Ответ на
Re: Adding a non-null column without noticeable downtime (Sameer Kumar)
Список
Дерево обсуждения
Adding a non-null column without noticeable downtime Zev Benjamin <zev-pgsql@strangersgate.com>
Re: Adding a non-null column without noticeable downtime Zev Benjamin <zev-pgsql@strangersgate.com>
Re: Adding a non-null column without noticeable downtime Vik Fearing <vik.fearing@dalibo.com>
Re: Adding a non-null column without noticeable downtime Sameer Kumar <sameer.kumar@ashnik.com>
Re: Adding a non-null column without noticeable downtime Zev Benjamin <zev-pgsql@strangersgate.com>
Re: Adding a non-null column without noticeable downtime Sergey Konoplev <gray.ru@gmail.com>
EXPLAIN does not appear to work on ALTER TABLE statements:
=> EXPLAIN ALTER TABLE "foo" ALTER COLUMN "bar" SET NOT NULL;
ERROR: syntax error at or near "ALTER"
LINE 1: explain ALTER TABLE "foo" ALTER COLUMN "bar" SET NOT NULL;
^
Zev
On 02/25/2014 01:56 PM, Sameer Kumar wrote:
> I think index should help.
> Why don't you try it out and check the explain plan of it?
> If you are planning to break it down as below:
> 1. ALTER TABLE "foo" ADD COLUMN "bar" boolean;
> 2. UPDATE foo SET bar = False; -- Done in batches
> 3. ALTER TABLE "foo" ALTER COLUMN "bar" SET DEFAULT False;
> 4. ALTER TABLE "foo" ALTER COLUMN "bar" SET NOT NULL;
>
>
> I would suggest on interchanging operation 2 and 3 in sequence
В списке pgsql-general по дате отправления
От: john gale
Дата: