I'm creating a social network app and i've denormalized data creating the timelines as a list of posts containing all fields in order to using only one query. The issue is that if every post has counters (likes, shares,comments), everytime a counter is updated how can I sync all post record in timeline? Or should i have only id in timeline and so i update only one table of posts and timeline query is made up of two query instead of one?
Thanks in regards
You may be able to store individual posts and then retrieve all of them using a single range query - this would allow you to easily update individual posts with counter data, but you'd still be able to retrieve all posts in the timeline using one query. See this article for an example using temperature recordings at a weather station.