Make a SQL Table for every User of Website (thousands) with thousands of rows? Make a SQL Table for every User of Website (thousands) with thousands of rows? sql sql

Make a SQL Table for every User of Website (thousands) with thousands of rows?


It never makes sense to have a database object per user. If you design your table and database structure appropriately, a table with a million rows is easily manageable.

A table-per-user will be very unmanageable, and that is not how relational databases are typically designed.

Create one table for the users and adhere to RDBMS best practices. Implement query tuning, and ensure there are appropriate indexes on the table, as well as updated statistics.


The usual answer is that "table per user" is a horrible design, and the simple solution is a single table with an extra field(s) to identify ownership.

e.g. having

table_1   table_2    table_3 ...... table_999999999id        id         id             id...       ...        ...            ...

is a massive waste of resources, whereas having

tableiduser...

is far easier to represent.


Many RDMS let you create partitioned tables; I think that would be the best choice in your case (one partitioned table for all users; depends on RDMS you are using, you will have different options for specifying partition key)