Mysql – Working on a blog creation website; should I be creating a new table for each blog, or keep everything on the same table

database-designMySQLpartitioning

So I'm working on this blog creation website as a side project. I don't actually expect it to become anything, but I want to make it as efficient as possible, even if just for practice.

The idea is that people can make accounts and then make as many blogs as they want, and post whatever they want on those blogs. My question is that should all of those blog posts be stored on the same table, or should I be creating separate tables for each new blog created? I don't know if there are limits or downsides to having hundreds or thousands of different tables, but I know that having everything on one table will slow down the selecting of posts for one specific blog, for example. This issue also applies to comments; are all comments on the site stored in one place, with an ID of what post they're about, or are they stored on separate tables depending on what blog they're on or something else. Or is there some other, better way that I should be using(without having to program a new database structure from scratch)?

I'm using PHP/MySQL for the backend. Any ideas would be much appreciated!

Best Answer

More than a few thousand tables or databases is a bad idea in MySQL. This because of MySQL's dependence on the filesystem, and most OS's can get bogged down when a directory has "too many" entries.

Hence, I vote for a single Blogs table. You will probably need few other tables to round out the app. Probably they will all be in a single database, but that does not matter much.