What is the best structure of database for activity (news) feed?
-
What is the best structure of database for activity (news) feed? Eg. A user is subscribed to activity of a group, actgivity of another user, and certain tag. HJow shall I organize database structure to show these activities to the user? I have the following structure of databases: User: id first_name last_name Group: id user_id (FK - User) name GroupTopic: id user_id (FK - User) group_id (FK - Group) name message Tag: id user_id (FK - User) name GroupTag group_id (FK - Group) tag_id (FK - Tag) GroupFollower: group_id (FK - Group) user_id (FK - User) TagFollower: tag_id (FK - Tag) user_id (FK - User) Eg I am subscribed to a group and a tag, so there is my user_id in tables GroupFollower and TagFollower. So, how in this case I will track that a new group that appeared in tag (GroupTag table) and that in group which I subscribed to new topic appeared (GroupTopic table). I assume there must be some Activity table Activity: id user_id (FK - User) - user who made changes ..... But what happens next? What should be fields and requests to get all new in groups, tags, etc.?
-
Answer:
Include a timestamp in the activities. Add a column to the users table 'last_checked'.select *from activitieswhere timestamp < ( select last_checked from users where user_id = @this_user);update usersset last_checked = @nowwhere user_id = @this_user;
Michael Tepfer at Quora Visit the source
Related Q & A:
- What is the best way to distribute an audio/video feed from a computer to TVs over existing indoor coax cable?Best solution by Audio-Video Production
- What is the best data model and database systems to store social graph?Best solution by Quora
- What is the best website to check travel and tourism news?Best solution by Yahoo! Answers
- What is the best key-value database?Best solution by Stack Overflow
- What Is The Best Food To Feed My Carnivorous Plant?Best solution by carnivorousplants.org
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.