
Ask HN: How do you count unread conversations in a messaging app? - amingilani
Self taught programmer here, I&#x27;m building Mailpenny.com, a messaging app that lets you pay users to have conversations.<p>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 &gt; last_accessed_at<p>But requires loading the records into my ORM and comparing the timestamps at the application layer. I&#x27;m afraid of scalability problems.<p>Is there a better way to do this? One that calculates the unread count at the db layer?<p>Sources and articles would be appreciated.
======
perfmode
It'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
Could you ELI5? Like I said, i'm a self taught programmer. :)

