sql - Keeping track of total inventory, sales, etc; stored procedure or something like elastic search -


i'm creating inventory management , sales tool e-commerce site. i'm new programming, , i'm curious best way keep track of totals. example company sells 200 products day, , able keep track of total amount of products sold in dollars, units sold, , graph data. able graph month's worth of these numbers (may 14: 145 units sold, $14,545, $2000 profit, may 15: etc). best way of doing this?

i thought creating total's table, , every time new order comes adds order value previous total's amount, seems cloudy quick if order doesn't logged.

doing select , adding total's each day month seems bad performance wise.

what options have , recommend best solution?

i recommend against creating totals table. while building report summarizes totals transactional data may seen cause performance problem, in practice might not bad think. 2 hundred orders per day on thirty days isn't many records modern relational database systems.

if did run significant performance issue 1 report, 1 thing run report during off-hours business may have , cache results of run in table use when wants view report. however, before going trouble recommend trying out mentioned above , see if performance of issue.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -