Suppose A follows 100 person,
then will need 100 join statement,
which is horrible for database I think.
Or there are other ways ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Why would you need 100 Joins?
You would have a simple table “Follows” with your ID and the other persons ID in it…
Then you retrieve the “Tweets” by joining something like this:
Now you just need a decent caching and make sure you use a non locking query and you have all information… (Well maybe add some userdata into the mix)
Edit:
tweet
Followers
The
Followerstable has a composite ID based on master andfollowerIDIt should have 2 indexes – one on “masterID – followerID” and one on “FollowerID and MasterID”