title: Optimization: Where to process data? Database, Server or Client?
body: <p>I've been thinking a lot about optimization lately. I'm developing an application that makes me think where I should process data considering balancing server load, memory, client, loading, speed, size, etc..</p>
  
  <p>I want to understand better how experienced programmers optimize their code when thinking about processing. Take the following 3 options:</p>
  
  <ul>
  <li>Do some processing on the database level, when I'm getting the data.</li>
  <li>Process the data on PHP</li>
  <li>Pass the raw data to the client, and process with javascript.</li>
  </ul>
  
  <p>Which would you guys prefer on which occasions and why? Sorry for the broad question, I'd also be thankful if someone could recommend me good reading sources on this.</p>