A call with a single instance of a stored procedure

Is there a way so that I can verify that the stored procedure completes completely before another instance starts?

I have to do 3 things in the procedure, and if two instances work at the same time, this will ruin the boundary case.

Example: counting rows, if <X insert row, count Y

if several instances of the stored procedure can work at the same time, I could pass by my target X. The chance is small, but it is not.

DB we use MYSQL5, but also interested in MSSQL

+3
source share
2 answers

Use transactions. After that, check the number of lines and rollback if it passes.

+4

, concurrency , .

. , . , .

0

Source: https://habr.com/ru/post/1725079/


All Articles