Split up db tables to balance load?
Let's say you have a website that users login to use. Each user access pages where they add and remove info to a single database table. Only they can see and access their data. Pretty straight forward.
Now, let's say the website is extremely popular. More users + more data = a very big table with lots of records.
So what I'm wondering, is it better for load b开发者_StackOverflowalancing reasons to instead of having one table that everyone adds similar data too, have multiple similar tables and users are assigned to a table that is shared with a set number of users.
So instead of 1000 users selecting and updating one big table, perhaps you have 100 tables that each only are accessed by 10 users.
What I'm wondering is this a type of database organizing strategy something that would improve load balancing? Or would it cause the same amount of load? Is this a common strategy and if so is there a name for it?
Sorry I thought I posted this on ServerFault. Please Migrate.
If and when you do run into a database-related bottleneck, it'll be when the size of your active data set grows beyond the amount of RAM on the server. At that point, splitting the table within the same server isn't going to buy you anything; it won't do anything to change the fact that disk IO is orders of magnitude slower than RAM. You'll be either upgrading RAM, or once you have done that as much as possible, sharding the data across multiple servers.
Lookup sharding. But I suggest you not bother with this now. You don't actually know what will be the slow point for your system until it's actually large and you can measure it.
Also see: http://dev.mysql.com/doc/refman/5.1/en/partitioning.html
精彩评论