I’ve two routes,
1) creating sub-tables for each user and storing his individual content
2) creating few tables and store data of all users in them.
for instance.
1) 100,000 tables each with 1000 rows
2) 50 Tables each with 2,000,000 rows
I wanna know which route is the best and efficient.
Context: Like Facebook, for millions of users, their posts, photos, tags. All this information is in some giant tables for all users or each user has it’s own sub-tables.
This are some pros and cons of this two approaches in MySQL.
1. Many small tables.
Cons:
Pros:
2. Few big tables
Cons:
Pros:
From my experience a table of two millions rows (I’ve worked with 70 millions rows tables) it’s not a performance problem under MySQL if you are able to load all your active index on memory.
If you’ll have many concurrent users I’ll suggest you to evaluate other technologies like Elastic Search that seems to fit better this kind of scenarios.