I
I
Ilya Myasin2017-05-12 09:39:57
MySQL
Ilya Myasin, 2017-05-12 09:39:57

Why does WordPress Multisite create tables for each site and not databases?

Hey!
WordPress has a " MultiSite " feature that allows you to run many different sites on the same codebase. In particular, the wordpress.com blog hosting works on this feature (here there is a video with a story about how it works).
Each site creates its own set of tables with an identical structure, differing in prefixes in the names, and all this lives in one database. There are shamanic ways to make different databases, but by design it works that way.
Does anyone understand why they chose this architecture?
Why not store everything in one database using partitioning / sharding? Seems like the most obvious option. Yes, it implies that you can't change the schema for a single site, but it doesn't seem to change anyway, it seems to be one of the basics of "bulletproof" WP.
Why not create a new database for each site? So, it seems, and more flexible (you can intelligently distribute sites across servers, you can change the schema), and safer. What problems can arise with an extremely large (hundreds of thousands) number of databases? Replication?
How would you build such a system? Two scenarios are possible:
1) the scheme and the set of features are fixed and unchanged,
2) third-party plugins can be installed, which, among other things, can change the scheme.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
WordPress WooCommerce, 2017-05-12
@maxxannik

Ptm that not everyone needs to create a database for each site. This is a complication. Violation of the principle of Occam's razor. WP developers with brains and therefore will not do such garbage.
Those who need it can set it up. There is such a possibility. For example, through HyperDB. There, a variety of types of sharding are supported.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question