←back to thread

Why AO3 Was Down

(www.reddit.com)
153 points danso | 1 comments | | HN request time: 0.246s | source
Show context
zerocrates ◴[] No.44470631[source]
Is it faster to convert a column like this to unsigned? Obviously assuming you don't use negative IDs in the application.

That's much more of a "kick the can down the road" solution to only double your usable range, but if all positive the values in the rows shouldn't actually have to change, just the column metadata, so it could theoretically be more or less instantaneous. I guess in practice this doesn't happen; the server would rather use its generic "rebuild the table" alter method for changing a column type.

But it seems like you could reasonably do it if it's a signed-to-unsigned change and there's no negative values and there's an index on the column to make checking that fact fast. Or one of those third-party/lower-level type tools could let you do it without any checking.

replies(2): >>44470957 #>>44471653 #
afandian ◴[] No.44471653[source]
I don't know what DB was used in this csae, but Postgres doesn't have unsigned integers. It always struck me as hugely wasteful, as e.g. sequences start at zero by default.
replies(2): >>44472229 #>>44476059 #
1. kristianp ◴[] No.44476059[source]
It's mysql.