Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Changing the type of the column is no big deal per se, except on a massive table it’s a non-trivial operation, BUT you also have to change the type in everything that touches it, everywhere it’s assigned or copied, everywhere it’s sent over the wire and deserialized where assumptions might be made, any tests, and on, and on. And god help you if you’ve got stuff like int.MaxValue having a special meaning (we didn’t in this context, fortunately).

Our hosting environment at that time was a data centre so we were limited on storage, which complicated matters a bit. Like ideally you’d create a copy of the table but with a wider PK column and write to both tables, then migrate your reads, etc., but we couldn’t do that because the table was massive and we didn’t have enough space. Procuring more drives was possible but took sometimes weeks - no just dragging a slider in your cloud portal. And then of course you’d have to schedule a maintenance window for somebody to plug it in. It was absolutely archaic, especially when you consider this was late 2017/early 2018.

You need multiple environments so you can do thorough testing, which we barely had at that point, and because every major system component was impacted, we had to redeploy our entire platform. Also, because it was the PK column affected, we couldn’t do any kind of staged migration or rollback without the project becoming much more complex and taking a lot longer - time we didn’t have due to the rate at which we were consuming 32-bit integer values.

In the end it went off without a hitch, but pushing it live was still a bit of a white knuckle moment.



Well done. Unsung heroes keeping it all going, and unsung villains who chose int32 in the first place long gone :-)


This comment can be reused when int64 is forced to change into int128 or int255 in the future.


Just use bignums. Seriously, a decent type system can use smaller representations for efficiency and not accidentally break the world.

That way, one can represent the numbers found in cryptography as … numbers, instead of opaque Base64- or (God help one) ASN.1-encoded byte sequences.

Machine words are an efficiency hack.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: