title: Performance comparison for SELECT and UPDATE when update a table partially
body: <p>There's a table need to be update. However, the amount of data changed (comparing the fresh data we got and those in database) is unknown.</p>
  
  <p>I can think of two ways to implement this.</p>
  
  <ol>
  <li>Select all data and compare them in web server. Then only update
  those changed.</li>
  <li>Simply update all data.</li>
  </ol>
  
  <p>I guess there's an performance borderline for them. If the effected rows is, let's say, less than 1,000, then maybe method 2 is better.</p>
  
  <p>My question is: </p>
  
  <ol>
  <li>Is there a general criteria for this? </li>
  <li>Can select compare with update operations generally? </li>
  </ol>
  
  <p>Suppose the database is MySQL, if needed.</p>