title: Are multiple sql querys a significant performance hit?
body: <p>I am using MySql (and PHP).</p>
  
  <p>It's best if I give an example:<br>
  I am making a query, say <code>SELECT * FROM a_table WHERE type='visible'</code> then returning the count. Then later I query again but <code>WHERE type='hidden'</code>, etc. I may query again to get the full contents. All queries are unique, but are from the same table. I also query multiple other tables with unique queries. (PLUS execution time of mysql_real_escape_string() sprinkled in the queries)</p>
  
  <p>I'm not sure how many queries I perform altogether. But I am worried that if I keep increasing queries, I will start getting into large execution times.</p>
  
  <p>My question is: are large amounts of queries noticeable on performance? If yes, is there a better solution on how to store that data? Is performing an initial query and storing all the rows in an array (large array could be 1000's of rows) and then manipulating the array faster (and/or feasible)? How many queries does this gray area become black and white?</p>
  
  <p><hr>
  <strong>Results from 'optimizing my queries'.</strong> </p>
  
  <p>These are execution times in seconds:</p>
  
  <ul>
  <li>No optimization: <code>.358 s</code></li>
  <li>Return <code>COUNT(*)</code>: <code>.321 s</code></li>
  <li>Reducing my column selection: <code>.266 s</code></li>
  </ul>
  
  <p>Although, the biggest was not opening a connection during every query. I was idiotically opening and closing a db connection each poll. By changing it to one continuous connection, I got execution time down to <code>.085 s</code>!</p>
  
  <p>Lesson learned. Thanks for all the input!</p>