Twitter (X) database schema

How a microblogging platform models its data: one tweets table covering tweets, replies, retweets and quotes, an asymmetric follow graph, a fanned-out home timeline, lists, bookmarks, and hashtags and mentions extracted at post time.

Twitter X ER diagram

Twitter (X) database schema n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 n1 users idBIGINT handleVARCHAR display_nameVARCHAR bioVARCHAR is_protectedBOOLEAN follower_countINTEGER following_countINTEGER tweet_countINTEGER created_atTIMESTAMP tweets idBIGINT author_idBIGINT kindVARCHAR bodyVARCHAR in_reply_to_tweet…BIGINT conversation_idBIGINT retweet_of_idBIGINT quoted_tweet_idBIGINT reply_permissionVARCHAR langVARCHAR reply_countINTEGER retweet_countINTEGER quote_countINTEGER like_countINTEGER created_atTIMESTAMP deleted_atTIMESTAMP follows follower_idBIGINT followee_idBIGINT notifications_onBOOLEAN created_atTIMESTAMP home_timeline_entri… user_idBIGINT tweet_idBIGINT author_idBIGINT reasonVARCHAR inserted_atTIMESTAMP likes tweet_idBIGINT user_idBIGINT created_atTIMESTAMP bookmarks user_idBIGINT tweet_idBIGINT created_atTIMESTAMP lists idBIGINT owner_idBIGINT nameVARCHAR descriptionVARCHAR is_privateBOOLEAN member_countINTEGER follower_countINTEGER created_atTIMESTAMP list_members list_idBIGINT member_idBIGINT added_atTIMESTAMP list_follows list_idBIGINT user_idBIGINT followed_atTIMESTAMP hashtags idBIGINT tagVARCHAR first_seen_atTIMESTAMP usage_countBIGINT tweet_hashtags tweet_idBIGINT hashtag_idBIGINT created_atTIMESTAMP mentions tweet_idBIGINT mentioned_user_idBIGINT start_offsetSMALLINT

Related database schemas