title: Basic data flow from user tracking to live feed
body: <p>Can someone explain how the flow is from point of user tracking to the live feed from the data model point of view? My dev team is having issues with this:</p>
  
  <p>When a user performs an activity the footprint is logged to a user_activity table which is the master table for all user footprints. This means every action by every user that needs to be tracked will be written here.</p>
  
  <p>Problems:<br>
  1) An activity is 1:M. Like I can tag 10 people in 1 photo. So obviously i will not write 10 foorprints in the activity table for this. Hence, do i need another table for storing the activity details?</p>
  
  <p>2) Since this table is logging all the activity on all objects from where it is fed into a activity feed table to output to the activity feed, the feed needs to know all the objects involved in the activity, so it can say "X tagged Mark, John, Sarah in tim's photo." where Mark, John, Sarah are basically user objects linking to their profiles. Photo is a photo object linking to photo table...</p>
  
  <p>The above is an example, but there are many many objects like Movies, Music, Brands, Cities, etc. So somwhow the system needs to know from the log table to the activity feed which object is what and where it is so it can pull in relevant data into the feed. To do this I have 2 colunms: object_id and object_type_id where object_type is like "User, Photo, Brands etc) and object_id is the ID of the object. But how to connect this with the actual tables?</p>
  
  <p>3) Lastly, is this design the best way to go how i have it to go from tracked data to a feed, that is log to a log table. Log table may have a detail table and log table joins with session table. Every 2 minutes a corn job is scheduled to pull this data into an activity feed table which is denormalized and pulls data from these + the objects tables for direct read into the live feed.</p>
  
  <ul>
  <li>The 2 min corn job also scares me because if there a lot of records then the system may take longer than 2 min to finish the job and there will be a backlog then. So any other methods i can use?</li>
  </ul>