Top
Best
New

Posted by danso 7/5/2025

Why AO3 Was Down(www.reddit.com)
156 points | 83 commentspage 2
notorandit 7/5/2025||
> typical database column

Typical for 70s and 80s.

Honestly, designing a 21st century database is a different thing if compared to back then.

You can use 128 bit integers, provided that you really want to use integers. And maybe you put a timestamp along.

rsynnott 7/5/2025||
The website appears to date from 2008. This was a _very_ common latent bug at that point, particularly because Rails would basically force you to implement it. I assume this got fixed at some point, but for a long time all ActiveRecord models had an autoincrementing ID, which had to be a signed 32 bit int. There were scary monkey-patching workarounds if you wanted something more sensible.

EDIT: And, yes, it is apparently Rails! https://fanlore.org/wiki/Archive_of_Our_Own#Timeline

throwawaysoxjje 7/5/2025|||
Nah I made the same mistake back in 2009 for a system that was storing behavior events during malware analysis.

You don’t often expect to have two billion of something until you do.

9dev 7/5/2025||
It's not like those two billion things just materialise in your database, right? Someone must have watched that graph climb, and climb, and climb, approaching the limit.
detaro 7/5/2025||
If they have that graph and remember the limit they choose 15 years ago... It's not something you think about constantly running a mostly stable code-wise site.
shakna 7/5/2025|||
Salesforce is a rather popular platform.

Its defaults are also either a 18-character ID, or a 32bit integer. So, unless you take the effort to actually fight Apex, you're gonna hit this problem sooner or later.

quickthrowman 7/5/2025||
Doesn’t an 18-character alphanumeric ID give you 18^36 combinations? 1.54 x 10^45 seems like enough combinations.
shakna 7/5/2025||
That's the point of the "or". You probably don't know which you're getting. It's what makes that particular design decision bite you more often.
Sharlin 7/5/2025|||
One of the first things I internalized about databases was "just always use BIGSERIAL for primary keys". There are very few good reasons not to.
looperhacks 7/5/2025|||
Maybe don't: https://wiki.postgresql.org/wiki/Don't_Do_This#Don.27t_use_s...
jarofgreen 7/5/2025|||
or use UUID/GUIDS, many databases (eg PostgreSQL) and frameworks (eg Django) support them.
dwedge 7/5/2025||
Using uuids can cause lots of problems with indexing, fragmentation, row size and index size
j16sdiz 7/5/2025||
let's use 128bit integer and handle them like floats in php!

and maybe put a 32bit timestamp along and pretend it can somehow store more than a 32bit integer can.

charcircuit 7/5/2025|
>to fix it they have to migrate the entire database to use a different type for bookmark IDs... except of course this will take a while because there are two Billion Of Them Lol

You can shard them between 2 tables. Then migrate them to a single one later.

ohdeargodno 7/5/2025|
There's no SLA for Harry Styles porn. Run the migration, lock the table for two days and redo the same in 13 years when you get to 4 billion bookmarks.
camel-cdr 7/5/2025|||
> There's no SLA for Harry Styles porn

But what about my good night's sleep? How can I go to bed without reading about my favorite blorbos?

ohdeargodno 7/5/2025||
Real ones use bookmarks to find them ag- ah, shit.

Real ones back them up in a single .txt file

kijin 7/5/2025||||
In 13 years, the Unix timestamp will probably be a much bigger problem.
rsynnott 7/5/2025|||
I mean I’d assume they went for a 64bit integer. In a few million years, people who are into weird porn about whatever the temporally local equivalent of Harry Styles is (probably some sort of robot) will once again be mildly inconvenienced.