Searching through a large chat room - Need advice please
Hello all,
I have a chat room project which will become very large quickly. Let's take an example of the table: id | user_id | group_id | message | read | created_at | updated_at
When a user reads a message, the read status goes from 0 to 1. Where I am not sure is on notifying the group users that some messages have not been read.
I wanted to add an index on "read", and "created_at" so I can go through all the unread messages that are older than 1 hour.
Every hour, I have a command on cron that checks all the unread messages per group and user id, then counts them and notifies each user on how many messages have been unread.
But would this makes sense to have indexes in these columns? Any tips would be appreciated please.
Thanks!
Thanks!
Please or to participate in this conversation.