2 ms·
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.
- perfmode 10y agoIt's good to start by measuring. Do a simple back of the envelope calculation. Start with this: How many conversations do you expect a user to have?
- amingilani 10y agoCould you ELI5? Like I said, i'm a self taught programmer. :)