Result caching vs continuous recalculation of the same?
The server gives the clients some data. For example, the statistics report of the store for the day. It contains rows with amounts purchases, including all taxes, etc and the last row is the sum of all categories (we want to sum many things and many rows). The total tax for all items, the total amount of purchases, etc. That is, when each query to the server you need to give this information to all who ask. How best to organize it - each time to recalculate the new amount for each request, or store the "amount" field in the database and adding new purchases to increase it?
P. S. If you constantly consider the same, theoretically, the process will work for nothing. Why infinite times to count the same thing, when you can just store the result and update it as new rows in a table?