Please am trying to model unread messages count. I have a user_messages table
CREATE TABLE user_messages ( user text, sender text, message text, read boolean, creation_date timestamp, PRIMARY KEY (user, creation_date) );How can i know the total number of unread messages? Do i need to create a counter table and update the user_messages table every time a message is read?
I also read that using select count(*) is too expensive and not recommended for production. Please I need a help.