DEV Community

Need idea to improve mysql's lock performance

huynhit-92 on December 09, 2019

We currently do goods management system like amazon With each product, there are about 5000 orders every day, which means that there are 5000 trans...
Collapse
 
proticm profile image
Milos Protic

An alternative approach would be to handle these things by using Database Concurrency. You should have a row version column (usually int or timespan type) and with it, you will ensure the correctness of the data.

For example, if two users access the same row and the first one updates it, the second one will have the incorrect data. The first user will update the row version which will indicate that the other user should reload. Usually, a message is displayed that the data is in use to the user with invalid data.