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 <sameer.kumar@ashnik.com>)
Список pgsql-general
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
Дата:
Сообщение: cannot delete corrupted rows after DB corruption: tuple concurrently updated
Следующее
От: Eliot Gable
Дата:
Сообщение: Re: JSON vs Text + Regexp Index Searching