title: Database design, how many times user visit specific page in application
body: <p>Web application will serve to user different posts from different categories.<br>
  For example category may be "Humor", "Sport", etc. </p>
  
  <p>So for this i will have <strong>simple table :</strong> <code>Categories(id, category_name)</code>.</p>
  
  <p>I want to keep track how many times user visit specific category, so next time when user logs in, his default page will be page with posts from two different categories which user visited most. </p>
  
  <p>Basic idea for this(i will use Ruby on Rails), before controller serve some page, counter for that category will be incremented and saved into DB.
  <strong>My problem is that i dont know where to keep this counter for categories?</strong></p>
  
  <p><strong>First idea(table Counters) :</strong><br></p>
  
  <p><code>Counters(id, category_name1, category_name2, ..., category_nameN, user_id)</code>  </p>
  
  <p>where category_name is integer field represent number of user visit(to spefic category).
  This idea is not good because when i add new category i must alter this table to add new column also.</p>
  
  <p><strong>Second idea :</strong><br></p>
  
  <p><code>Counters(id, count, category_id, user_id)</code>  </p>
  
  <p>for me better idea but still not good performance i guess, because per ONE user i will have N rows, where N is number of categories. So <strong>if i have 1000 users and 10 categories that will be over-kill ?</strong></p>