What is the relationship between isolation levels and locks in mysql?

isolation level and lock appearance seem to solve the problems caused by database transaction concurrency, right? What"s the relationship between the two? I"m a little confused

Mar.28,2021

lock is a classic solution to concurrency problems. For simple concurrency problems, locks can be used. However, for complex problems such as transactions, it is not possible to have locks alone, such as whether two transactions can see the data modified by each other, and whether they need to ensure that the reads within a transaction are repeatable. Different solutions to these problems will affect the logic and execution results of complex applications in concurrency, and a little carelessness will lead to wrong results. Therefore, the concept of isolation level is introduced to standardize the isolation of transactions, that is to say, isolation levels are actually introduced to deal with the complex problem of transactions, and there is no isolation level if there is only concurrency without transactions.

in a nutshell, locks are the basis of concurrency control, and isolation levels are the overall solution to transactions at a higher level.

Menu