title: Which is the most efficient SELECT method and why?
body: <p>Consider a site where people vote up (+1) or down (-1) on their favourite colour and I have two tables:</p>
  
  <p>One lists all the colours people can vote for and the second table records each individual vote made, what colour it was for and whether is was +1 or -1.</p>
  
  <p>With regards to fetching the aggregate vote for a specific colour, would it be more efficient include an aggregate score on the colours table and when a person votes there is an insert statement and an update statement:</p>
  
  <pre><code>INSERT INTO votes (colour,vote) VALUES (red,-1);
  UPDATE colours SET score=score-1 WHERE colour='red';
  
  SELECT score FROM colours WHERE colour='red';
  </code></pre>
  
  <p>Or would it be more efficient to just have a single INSERT statement when a vote is made, and then to fetch the score you;</p>
  
  <pre><code>SELECT SUM(vote) AS score FROM votes WHERE colour='red';
  </code></pre>
  
  <p>I guess when there's a very small number of votes then option #2 is best but does option #1 become better when the votes table is very large?</p>
  
  <p>Is there some tool that I can use to give a kind of ranking on certain SQL Queries depending on table sizes etc?</p>