Re: ALTER TABLE ADD COLUMN fast default - Mailing list pgsql-hackers

From Andres Freund
Subject Re: ALTER TABLE ADD COLUMN fast default
Date
Msg-id 20180329213129.peqeam7t2a3ab2xk@alap3.anarazel.de
Whole thread Raw
In response to Re: ALTER TABLE ADD COLUMN fast default  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: ALTER TABLE ADD COLUMN fast default  (Tomas Vondra <tomas.vondra@2ndquadrant.com>)
List pgsql-hackers
Hi,

On 2018-03-29 17:27:47 -0400, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > There's plenty databases with pg_attribute being many gigabytes large,
> > and this is going to make that even worse.
> 
> Only if you imagine that a sizable fraction of the columns have fast
> default values, which seems somewhat unlikely.

Why is that unlikely?  In the field it's definitely not uncommon to
define default values for just about every column. And in a lot of cases
that'll mean we'll end up with pg_attribute containing default values
for most columns but the ones defined at table creation. A lot of
frameworks make it a habit to add columns near exclusively in
incremental steps.  You'd only get rid of them if you force an operation
that does a full table rewrite, which often enough is impractical.

Greetings,

Andres Freund


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: ALTER TABLE ADD COLUMN fast default
Next
From: Bruce Momjian
Date:
Subject: Re: cannot drop replication slot if server is running in single-usermode