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

From: Guido Neitzer <guido(dot)neitzer(at)pharmaline(dot)de>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Difference between "add column" and "add column" with default
Date: 2006-03-20 09:52:36
Message-ID: A447D03A-AE21-435F-9E88-EB3EBDC31EC5@pharmaline.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2006-03-20 10:24:48 Re: vacuum full taking much longer than dump + restore?
Previous Message Dragan Matic 2006-03-20 09:50:42 vacuum full taking much longer than dump + restore?