3 ms·
In postgresql: The DROP COLUMN form does not physically remove the column, but simply makes it invisible to SQL operations. Subsequent insert and update oper
by awestroke 6y ago
In postgresql:
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.
- airstrike 6y ago> The space will be reclaimed over time as existing rows are updated. Or as you VACUUM, correct? I think it lets you specific a column name too
- masklinn 6y agoVACUUM just marks tuples as free spaces so they can be reused. This is part of > The space will be reclaimed over time as existing rows are updated. because of MVCC, updating a row really inserts a new row and the old one eventually becomes free space (once a vacuum comes around to marking it). VACCUM FULL, however, will rewrite the entire table.
- airstrike 6y agoGood to know, thank you very much