I'm not sure if it's possible for SE folks to disclose architectural details, but I'm very curious about what happens in the backend when a new SE site is created. Is there one big database that holds all of the SE site data, with all Questions being stored in a single table, and perhaps a table of Sites that gets linked to relevant content? Or is it more complex than that?

Update: I've spent the past week learning about multi-tenancy, and I'm even more curious about this now. On my app, I implemented a Tenants table, and every non-constant model has a FK of TenantId. This keeps the app in a single app pool with a single database.

So, asked another way:

How does SO do it, in the context of SE sites, and enterprise clients?

  • 5
    In very basic terms, each site has its own DB. Its schema is similar, but not identical, to what's exposed via the Data Explorer.
    – Adam Lear StaffMod
    Commented Oct 7, 2013 at 1:31
  • 4
    @AnnaLear - Thank you. If you have a chance, I'd love to learn more about why this approach was taken. As a junior dev I'd be scared of this architecture because one change to the table structure of Questions would have to be applied to as many databases as there are sites... right?
    – RobVious
    Commented Oct 7, 2013 at 1:33
  • 4
  • 1
    @AnnaLear "similar, but not identical" schemas have been a maintenance nightmare in my experience, wonder if this is the case for SE
    – gnat
    Commented Oct 10, 2013 at 10:34
  • 2
    @gnat I think she meant that while each site's schema is the same, that shared schema is close but not identical to the SEDE schema.
    – Kevin
    Commented Nov 5, 2013 at 3:50
  • @Kevin I see, thanks! that would make a pretty good sense, then
    – gnat
    Commented Nov 5, 2013 at 3:59
  • 1
    @gnat Yes, Kevin got that right. The actual schema is shared between the sites and what's published in the data explorer is a modified version of that.
    – Adam Lear StaffMod
    Commented Nov 5, 2013 at 6:07
  • 1
    @RobVious Sorry, missed your comment. With the caveat that I'm currently a community manager and not a developer here, so my understanding of our infrastructure is a bit hazy... Yes, each change to the database structure is applied to every site. However, since every site runs on the "Stack Exchange engine", we actually want that. Having each site have its own customized db schema is a recipe for pain when fundamentally they are the exact same thing just with different content.
    – Adam Lear StaffMod
    Commented Nov 5, 2013 at 6:10
  • 1
    @Anna Nick has great technical knowledge and sometimes love to boast about it - can you nudge him in the direction of this question? ;) Commented Nov 5, 2013 at 14:16


You must log in to answer this question.

Browse other questions tagged .