3

I'm looking foward to see how is designed the data base model that supports a site like stackoverflow, my motivations is mainly to learn how others modeled this domain.

I'm not looking for an API, or to download the actual dumps of the DB, i'm looking more like an entity-relation diagram to view the system's DB desing, that after all, for me, is the cornerstone on which relies any system.

If is not open source or my question is out place (but there is a place for it!), let me know properly (an please let me know where to head to).

10
  • i may share with you my "Point of view" on this... if any of you have interest! of course
    – Victor
    Commented Mar 12, 2019 at 14:19
  • 2
    Take a look at data.stackexchange.com
    – yivi
    Commented Mar 12, 2019 at 14:28
  • This may help.
    – TiiJ7
    Commented Mar 12, 2019 at 14:29
  • Thanks for the tips, at least the show me somewhere to go. What about having an image or drawing of the design?
    – Victor
    Commented Mar 12, 2019 at 14:36
  • 3
    @Victor Build one from the information in those links.
    – Dan Bron
    Commented Mar 12, 2019 at 14:38
  • i was asking intentionally what i was asking @DanBron , thanks for the tip anyway
    – Victor
    Commented Mar 12, 2019 at 14:43
  • btw does Stackoverflow relies on a oracle dbms?
    – Victor
    Commented Mar 12, 2019 at 17:16
  • @Victor nickcraver.com/blog/2016/02/17/… Commented Mar 12, 2019 at 17:37
  • 2
    meta.stackexchange.com/questions/250396/…
    – rene
    Commented Mar 12, 2019 at 21:27
  • @peterh yeah... i don't know... you know i really come to this place for asking where i can find a drawing about the models and i do it an polite way... really don't know why the donwvotes and nobody explain what is "wrong" in my question at first place... well luckly rene provides me an answer that helps me a lot!. Clearly there is people that only like to say "NO" and nothing more, i supects that most downvoters here done that, i guess nobody of them take the time to deal with a person asking a question like they will do in real life having the person right next to them.
    – Victor
    Commented Mar 13, 2019 at 17:31

1 Answer 1

20

I have created this ERD back in 2015 based on the database schema of the Stack Exchange Data Explorer. It surely doesn't have all the tables found in the production database but it does have the core tables that form the basis of the Q/A model and moderation features.

erd

Find my full answer on Database Diagram of Stack Exchange model?

4
  • 2
    Love to have an answer despites the angry downvoters that do nothing other than downvoting! Thanks!! That shares me a lot! I Have a design very similar (less complex) as i do not use aggretated informaion on my tables (For example: UPVotes in USers table, is an aggregated value product of apply a function that summarizes the count of votes (of type=UpVote) that you have in the Votes table,i mean, is not a granular value) I wonder how you mantein those values well. Triggers or rules , i guess , would do the works. BUt never used them.
    – Victor
    Commented Mar 13, 2019 at 13:02
  • 1
    SE doesn't use triggers. It's all in the app layer but they do have batch jobs that run at regular intervals, one of them is to do reputation recalcs for affected users that probably updates those aggregate values in the users row.
    – rene
    Commented Mar 13, 2019 at 14:11
  • thanks rene, and allow me to dispach another question if i can... having batch jobs that updates aggregated values on tables is something that was designed from the strach or is a product of evolving the system? [probably due to performance issues (i mean, the time to calculate each aggregation can be cumbersome as data grows in size)]. You seems the right person to ask that. Long ago i have read in Graddy Booch's book that system evolves from simpler forms, i would guess that initially there were a lot of calculations on the fly.
    – Victor
    Commented Mar 13, 2019 at 15:13
  • 1
    For SE performance is a feature so I'm pretty sure they anticipated upfront and designed for off-loading processing heavy transactions to a later stage. IIRC they only store in a table that userprofile needs a reputation recalc. The actual recalc is then done in the batch without hogging a server thread that is supposed to deliver content to the end-user.
    – rene
    Commented Mar 13, 2019 at 16:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .