The History Of The Facebook ID

How does Facebook generate your ID when you join the site? While new users of the site aren’t aware of the use of numerical IDs, since the beginning Facebook’s profile system has been based on IDs to identify each user. While the site first began by auto-incrementing IDs, the model that the site has used for generating these IDs has changed over time. The history of the Facebook ID isn’t a regularly discussed topic among most users, however one Quora user posted the question and Justin Mitchell posted a great response.

According to Justin, here’s the history of the Facebook ID:

This is my understanding, but I’m probably wrong.

Facebook’s user ID schema reflects the history of the site as it transitioned from a single-server single-school operation to 400 million users. User ID assignment has gone through several phases, notably:

Harvard only. Facebook (or thefacebook.com, as it was called back then) was opened up to Harvard running off a single box that had mysql and apache. IDs were auto-incremented, starting at 4 (hi Zuck).

Other schools. Other schools were initially completely separate sites, operating on their own boxes. IDs were still auto-increment per SQL box, but each server/school had a different prefix. For instance, all Columbia IDs are between 100000-199999 and all Stanford IDs are between 200000-299999. You can determine what school any early Facebook user attended based on his or her user ID.

High schools. Someone must have figured out that this ID system didn’t scale very well, so Facebook changed its DB layout when high schools were introduced. While all the college users maintained their current DB, high school users were randomly assigned to one of many many high school DBs. These users IDs hash to the correct database, rather than simply being floor(ID / 100000).

Open registration. Facebook maintained a similar layout once open reg was launched, except the new databases weren’t signified as “high school.”

64 bit. Given Facebook’s growth rate, it was estimated that the entire world would be on the site by 2011, overflowing 32-bit space. While we considered limiting the site to the first 4-billion people to register and lobbying governments to reduce the world’s population, the growth team pushed pretty hard to just increase the ID space to 64-bit.

Related Stories
Mediabistro Course

Content Marketing 101

Content Marketing 101Almost 60% of businesses use some form of content marketing. Starting December 8, get hands-on content marketing training in our online boot camp! Through an interactive series of webcasts, content and marketing experts will teach you how to create, distribute, and measure the success of your brand's content. Register now!