from Hacker News

PostgreSQL: How to convert 2B rows to bigint

by cbisnett on 7/1/20, 2:10 PM with 1 comments

  • by SigmundA on 7/1/20, 2:30 PM

    One thing I really wish database would focus on is online schema changes and metadata only changes.

    I know this is not an easy problem to solve, and there are a lot of performance reason say changing a 4 byte int to an 8 byte int requires a data migration rather than just a metadata change.

    However I think with enough thought even that could be done and still be performant. Maybe a hit as a hidden secondary column is added and data slowly migrated to it then the old column finally removed.

    Although maybe just going to variable length number storage would be better just like strings (varchar) then min and max values are just constraints not a storage issue.