Panlantic82 Panlantic82 - 2 years ago 69
SQL Question

How to store changes in SQL database?

I am making an app, that uses Instagram data to create some kind of rating of user profiles and their posts. My app periodically add new like/comment count with timestamp for stored posts in db and check profiles for new posts to add them in database.

Database schema for posts updates table:

id, post_id, user_id, likes_count, comments_count, timestamp

So, the question is: is there more efficient way to store count (likes/comments) updates?

Answer Source

Nothing wrong with what you have done. It is efficient just set default values of zero for the likes_count and comments_count fields others not null.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download