Ask HN: How do you count unread conversations in a messaging app?
Self taught programmer here, I'm building Mailpenny.com, a messaging app that lets you pay users to have conversations.
How does one keep track of unread conversations to show in the inbox? Currently I store the last_accessed_at time, and check if last_message_from_other_user.created_at > last_accessed_at
But requires loading the records into my ORM and comparing the timestamps at the application layer. I'm afraid of scalability problems.
Is there a better way to do this? One that calculates the unread count at the db layer?
Sources and articles would be appreciated.