title: Functions in MySQL or PHP
body: <p>Is it generally better to run functions on the webserver, or in the database?</p>
  
  <p>Example:</p>
  
  <pre><code>INSERT INTO example (hash) VALUE (MD5('hello'))
  </code></pre>
  
  <p>or</p>
  
  <pre><code>INSERT INTO example (hash) VALUE ('5d41402abc4b2a76b9719d911017c592')
  </code></pre>
  
  <p>Ok so that's a really trivial example, but for scalability when a site grows to multiple websites or database servers, where is it best to "do the work"?</p>