rdbms - What is Locking in MySQL and when would you use it? -
What is locking in MySQL (or any RDBMS) and when will you use it? An ordinary man's statement with an example would be very good!
We have a joint bank account with the remainder of $ 200
I put my card into the machine, checks the machine that I have a balance of $ 200
In the meantime, you go to the bank and ask for $ 50, teller your account Brings and confirms that you have money.
I request a refund of $ 200, the machine means that my money gets $ 200 from me and my balance is set to $ 0
Taylor will pay your money Calculates and gives you $ 50, the system updates the balance in the account in the form of $ 150 ($ 200 - $ 50 withdrawal)
So now our account has $ 250 in cash and $ 150 remaining. The advantage of $ 200
The problem is that if you handle that transaction in the same way, then we will lose the concurrency and the performance will be lost, so the different transaction isolation level
, Which is used on the basis of scenario, for example you may not care that anyone can modify the data that has been read in the transaction.
You should learn this and understand the scenarios where they are applicable.
Comments
Post a Comment