title: Handling Read/Unread Posts for users like mail in mysql
body: <p>I need to handle read/ unread status of a post per user.
  Write now i am using a denormalized column to store comma separated user_ids. Since it is a text column the performance of the select query is degraded.</p>
  
  <p>Now i would like to assign a constant for all the users say
  User A - 1, User B-2, User C-4 and User D-8 (Bitwise), and store its combination in a integer column.So when the user A,C read the value for the integer column will be (1+4) 5.
  And use the bitwise operator in criteria to query the read/unread post. The problem is the no. of users that i can store as combination is restricted say 62 user's status in a column. If i have to extend further i may have add another BIGINT column to store other users.</p>
  
  <p>What could be the best way to store that information.
  Following are the action i need to do.</p>
  
  <ol>
  <li>when a new reply is posted then i have to update the value as 0 (to make unread for every one).</li>
  <li>Update the status in the column when a user reads the post.</li>
  <li>Select all the unread post for an user.</li>
  </ol>
  
  <p>EDIT:
  I trying to address 3rd action indirectly. i add that integer column in select columns list and find the read status for the user in application code instead of adding as mysql criteria. Any way this is not a solution. I still need of a good one.</p>