What is the effect on record size of reordering columns in PostgreSQL?

Posted by Summer on Stack Overflow See other posts from Stack Overflow or by Summer
Published on 2010-04-08T16:09:32Z Indexed on 2010/04/08 16:23 UTC
Read the original article Hit count: 214

Filed under:

Since Postgres can only add columns at the end of tables, I end up re-ordering by adding new columns at the end of the table, setting them equal to existing columns, and then dropping the original columns.

So, what does PostgreSQL do with the memory that's freed by dropped columns? Does it automatically re-use the memory, so a single record consumes the same amount of space as it did before? But that would require a re-write of the whole table, so to avoid that, does it just keep a bunch of blank space around in each record?

Thanks!

~S

© Stack Overflow or respective owner

Related posts about postgresql