Settings

Theme

What Happens When You Drop a Column in Postgres

thenile.dev

6 points by gwen-shapira 8 months ago · 1 comment

Reader

gwen-shapiraOP 8 months ago

When you run ALTER TABLE test DROP COLUMN c Postgres doesn't actually go and remove the column from every row in the table. This can lead to counter intuitive behaviors like running into the 1600 column limit with a table that appears to have only 2 columns.

I explored a bit what dropping columns actually does (mark the column as dropped in the catalog), what VACUUM FULL cleans up, and why we are still (probably) compliant with the GDPR.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection