mysql twitter/facebook like status feed
- by barjonah
Hi, I have two tables. One named status like this...
user_id |  status
--------+-----------
      1 |  random status from user 1
      2 |  random status from user 2
      3 |  random message from user 3
      4 |  staus from user 4 
      1 |  second status for user1
etc...
and another named users_following like this...
user_id |  is_following
--------+-----------
      1 |  2
      1 |  3
      2 |  1
      3 |  2
meaning that user 1 is following both users 2 and 3 etc...    
So, let's say I chose user 1.  What is the best query (performance wise) to show the status updates of users that user 1 is following, in this case users 2 and 3
currently I have something like 
SELECT * from status WHERE user_id IN(SELECT is_following FROM users_following 
WHERE user_id='1') LIMIT 0,5 
but I don't think this is good for performance if a user was following thousands+ of users