R
R
RastikRus2018-03-21 15:11:07
MySQL
RastikRus, 2018-03-21 15:11:07

Locks in mysql, is there an alternative?

There is a table, at a certain moment 20-30 requests can come at the same time. At this moment, a new record is created in the table for each, and at another time, you need to update the time and increase the number in it. Since there are a lot of requests coming at the same time, not all numbers add up and, as a result, not all data is taken into account in the next selecte. In order to avoid this, I began to use locks, but because of this, the speed of work drops. How can this be avoided?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Aksentiev, 2018-03-21
@Sanasol

not all numbers add up

Because for such things it is necessary to do at least
not this way, but this way And most likely the problem will be solved. At least there is enough information to suggest only such a solution.

D
Dmitry Donkovtsev, 2018-03-21
@Demetriy

Read about the queues, if on your fingers, then you need a separate script (daemon) that will take data in batches (by n records) from table 1 at certain intervals and sequentially read them and update table 2, the fact of processing can be fixed as using additional . fields ala "is_processed", and by creating a separate table, the rows in which will be deleted during their processing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question