social netwroking website - database design - online users?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • someoneelseisnew
    New Member
    • Dec 2009
    • 1

    social netwroking website - database design - online users?

    i am trying to put together the frame work for a social networking site. no small feat :) i've been reading up n database structure, but there's one thing i wasn't able to find.

    how do sites like facebook show online users?

    is it simply a field in the user table that shows if they are online? how is it not slowing down the db to check a user table with over 100000 uses to see who is online?

    or is there one table for online users that holds a ID number? if so, how then do we determine if the user is still active? ie, they closed the browser window without logging out?

    any advice is MUCH MUCH MUCH appreciated!
  • dlite922
    Recognized Expert Top Contributor
    • Dec 2007
    • 1586

    #2
    You really can't. It just an assumption and a timeout, is what it comes down to.

    Have a data field with the user that stores their last activity time. All queries will calculate the difference in time between that and the current time. Depending on your needs, you can adjust what this value should be, 10 minutes, 30 minutes, an hour?

    That's how I'd do it.

    Comment

    Working...