Home > database > Many users input data at the same time, single number how to solve
Many users input data at the same time, single number how to solve
Time:09-27
The first user to add data access to the largest number is S2019122601, on the basis of the + 1, get S2019122602, not to save the data, there were also added to the second user data access number is S2019122602, how to solve the problem of the single number? Does anyone know how to solve, thank you!
CodePudding user response:
When users click save in the database to obtain the biggest single number,
CodePudding user response:
The number generated and take them to the insert statement and verify whether there is
CodePudding user response:
Multi-user is parallel, serial, but you can only have to line up,
According to this to: https://blog.csdn.net/yenange/article/details/78903480
Store insert into serial execution can,
CodePudding user response:
Is there a way can be obtained in the second user number is automatically get to S2019122603
CodePudding user response:
Don't use maximum record in a table, with sequene directly (if your version does not support, then directly in a table) If you must use maximum record in a table, then the requirements of the transaction isolation level to achieve SERIALIZABLE, this will seriously affect the performance, and easy to deadlock