Re: Dropping column from big table - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Dropping column from big table
Date
Msg-id 202407111305.swxs3no6pmhy@alvherre.pgsql
Whole thread Raw
In response to Re: Dropping column from big table  (Ron Johnson <ronljohnsonjr@gmail.com>)
List pgsql-general
On 2024-Jul-11, Ron Johnson wrote:

> Anyway, DROP is the easy part; it's ADD COLUMN that can take a lot of time
> (depending on whether or not you populate the column with a default value).

Actually, ADD COLUMN with a default does not rewrite the entire table
either, starting from pg11.

"Major enhancements in PostgreSQL 11 include:
[...]
* Many other useful performance improvements, including the ability to
  avoid a table rewrite for ALTER TABLE ... ADD COLUMN with a non-null
  column default."

https://www.postgresql.org/docs/11/release-11.html

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/



pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: Dropping column from big table
Next
From: Dimitrios Apostolou
Date:
Subject: Re: Query on partitioned table needs memory n_partitions * work_mem