I am developing a system in which there is a database for storing users and information related to users. More specifically, each user in the table has very little information. Something like Name, Password, uid.
Then each user has zero or more containers, and I first did this to create a second table in the database that contains the containers and has a field that refers to the user who owns it. So something like containerName, content, owner.
Thus, a request for data from a container will look something like this:
SELECT content
FROM containers
WHERE (containerName='someContainer' AND owner='someOwner');
My question is that this is a good way, I think scalability means that we have thousands of users who say ... 5 containers each (however, each user may have a different number of containers, but 5 will probably be typical case). My concern is that searching through the database will be slow when there are 5 records out of 5 * 1000 records that I could use in a single query. (Usually, we may need specific container content from our query, and we examine the database, mainly 4,995 records overhead, right? And what happens if I sign up a million users, this will become a huge table that just intuitively feels like a bad idea .
The second lesson that I had would be to have tables for the user, however this is not a good solution, as it would give me 1000 tables in the database, which (also by intuition) seem like a bad way to do this.
Any help in understanding how to do this would be greatly appreciated, I hope that everything will be clear and easy to follow.
source
share