Steve
Steve

Reputation: 130

How to design a database that stores user specific data

If I put the user specific data all in one single table, as the number of users increase, the table size is going to grow too large so that queries will run slow. I know partitioning the table is one solution. But is there a way to design it so that the table won't grow too large? For example, each user has her own table? Every time a new user is created, a new table for this user will be created?

Upvotes: 1

Views: 276

Answers (1)

Bohemian
Bohemian

Reputation: 425043

How many users are you expecting? If it's less than 100 million, you'll be fine with one table . Even with more users, you'll still probably be fine. Worry about it only if it becomes a problem.

Just make sure you have appropriate indexes for finding the rows efficiently, and only find them using your efficient indexes.

Planning your database storage plan for "large data volumes" early is a mistake - it breaks the rule "don't optimize early". If you get millions of users, and performance is a problem, you'll have enough money to pay someone to solve it for you.

Just as an aside, having one table per user is completely insane.

Upvotes: 6

Related Questions