3 ms·
postgresql does essentially nothing on a drop column, in part because it doesn't use fixed-size tuples: > The DROP COLUMN form does not physically remove the c
by masklinn 6y ago
postgresql does essentially nothing on a drop column, in part because it doesn't use fixed-size tuples:
> The DROP COLUMN form does not physically remove the column, but simply makes it invisible to SQL operations. Subsequent insert and update operations in the table will store a null value for the column. Thus, dropping a column is quick but it will not immediately reduce the on-disk size of your table, as the space occupied by the dropped column is not reclaimed. The space will be reclaimed over time as existing rows are updated.
but if you VACUUM FULL (or CLUSTER) it will immediately rewrite the entire table.
Also note that storing a null means forcing a null bitmap for every row (even if it's not otherwise used).