title: mySQL - Do the operations and store in table or do the math every time I fetch the data
body: <p>As simple as that, what's better in terms of performance? I'm doing some calculations based on user data input (simple arithmetic), should I do the operations and store the result in the database or do the operation each time I do the SELECT query?</p>
  
  <p>Option 1: operate each time I fetch data from the table</p>
  
  <pre><code>SELECT 
    some_random_fields,
    salary,
    extra_days,
    extra_days * salary * 0.05 AS extra_income 
  FROM 
    table 
  WHERE 
    user_id = 'xxx'
  </code></pre>
  
  <p>Option 2: operate once, INSERT INTO table, fetch result without operating (extra column)</p>
  
  <pre><code>SELECT 
    some_random_fields,
    salary,
    extra_days,
    extra_income 
  FROM 
    table 
  WHERE 
    user_id = 'xxx'
  </code></pre>