title: MySQL Performance
body: <p>I'm making a Web Application and i'm using MySQL as my DB Backend. My DB will be bigger eventually, like more than 100 million rows in some tables. I just wanted to confirm one thing about such big tables. </p>
  
  <p>Opt 1 . Let's say the tables have Primary Keys and make my query using the Primary Key , but i will need to make run mysql queries, say 100 queries for each user login.</p>
  
  <pre><code>USERID  KEYS
  
  1       {1,2,3,4}
  </code></pre>
  
  <p>i will get KEYS for user and then make primary key queries to get each value</p>
  
  <pre><code>PRI.KEY  Value
  
  1        google
  
  2        yahoo
  
  3        aol
  
  4        windows
  </code></pre>
  
  <p>If a user logs in,i need to get his Bookmarked sites for example. So i will make two queries 
  Select KEYS from TB_KEYS where USERID=1; Then i parse the KEYS and for each key,
  Select Value from TB_VALUES where PRI.KEY=(KEY - i obtained ,parsing from the first query);</p>
  
  <p>Opt 2. I m not making queries using the Primary Keys , but i will need to run few queries for a user's login.</p>
  
  <p>OPT_TABLE_2</p>
  
  <pre><code>USERID  KEY         Value
  
  1       1           google
  
  1       2           yahoo
  
  1       3           aol
  
  1       4           windows
  </code></pre>
  
  <p>Select value from OPT_TABLE_2 where USERID =1;</p>
  
  <p>Which option would be better ..?</p>