Difference between "add column" and "add column" with default

Поиск
Список
Период
Сортировка
От Guido Neitzer
Тема Difference between "add column" and "add column" with default
Дата
Msg-id A447D03A-AE21-435F-9E88-EB3EBDC31EC5@pharmaline.de
обсуждение исходный текст
Ответы Re: Difference between "add column" and "add column" with default  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Difference between "add column" and "add column" with default  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi.

What is the technical difference between adding a column to a table
and then apply a "set value = ..." to all columns and adding a column
with a default value = ...?

I have seen that the first duplicates all rows, I had to vacuum and
reindex the whole table. Okay so far, I have expected this. But this
wasn't necessary with the second option, nevertheless, fetching some
rows showed, that the value of the new column was my default value.

So, I'm curious: what happens (not) here?

Thx for the explanation.

cug

Вложения

В списке pgsql-general по дате отправления:

Предыдущее
От: Dragan Matic
Дата:
Сообщение: vacuum full taking much longer than dump + restore?
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: vacuum full taking much longer than dump + restore?