V
V
Vagif Abdullayev2018-04-18 10:58:44
Database
Vagif Abdullayev, 2018-04-18 10:58:44

Do I need to recalculate all database records (several million) to display stock balances?

Hello. Faced such task.
There is a stock, to which goods are added and subtracted several tens of thousands of times daily.
The final balance in the warehouse can be calculated by simple summation or subtraction of goods. And save the state of the drain, for further output to reports. But this will not work, because sometimes you need to change the records retroactively and then you have to recalculate everything again. Thought each time at request to recalculate all operations. This option will also make it easier to display the stock status on a specific date, which is also needed.
I have never worked with big data, but for some reason it seems that after some time, for example, in a year, when several million records have accumulated, it will be unrealistic to recalculate everything.
The program is written to order. What will be the iron is initially unknown. The warehouse is connected to a point of sale from which thousands of sales take place every day. From each product (running) on ​​average, probably 5-6 decreases. And the same amount is delivered to the warehouse.
I would like to know your options for implementing this task.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
D
d-stream, 2018-04-19
@d-stream

The specifics strongly depend on the architecture. The only thing I can say is that any helpers in the form of subtotals can turn out to be rather evil.

V
Vagif Abdullayev, 2018-04-21
@mucuna

Maybe the question is not addressed there?
Maybe I need to dig towards algorithms, not databases?

M
mynigoo, 2018-04-23
@mynigoo

you need to dig towards 1s trade and warehouse, and not reinvent the wheel. there are many more discoveries ahead, for example, the concept of "closed period"

L
Leonid, 2019-04-09
@caballero

Shaw is a few million for a modern server.
Recalculation allows you to get balances and turnovers for any date and period without crap with intermediate balances.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question