Hey there,
Context:
My app is pretty much an instagram clone.
I’ve a “Posts” class and a “Followers” class.
Every user can have any number of posts and any number of followers.
Problem:
I would like to be able to query all the “posts” of the users I’m currently following.
I could first query the “Followers” class and fetch all the users I’m following and then fetch their posts.
However saving users ID’s to an array would reduce the number of queries to 1 and make the job a bit easier.
Let’s say I’m following 1 million users. Would it be ok to keep all theirs usernames in a array in my “User” class under a column named “following”?
Can the database handle that? Can this create problems? If this is not recommended for any reason then I won’t implement it this way.
The usernames are 32bytes in the worse case scenario
What’s in your opinion the best solution?