0

I am developing application that will run from multiple comuters. I want to lock mysql tables, so there won't be process concurrency issues, like one process is writing and other process is reading at the same time. Or what is even worse both process simultaneously writing (updating) different values. MySQL provides locks, but documentation says that we should avoid using locks with InnoDB. Read here. Please provide some advices what to do in this situation. Thanks everyone.

Milos Ljumovic
  • 403
  • 4
  • 16

1 Answers1

0

InnoDB is a transactional storage engine with full ACID support. One of the properties of InnoDB is that it handles the concurrent updates. How exactly depends on the Isolation level, but generally InnoDB disallow two transactions to modify the same row by locking the row. It does not lock the whole table so other records can be modified by other transactions.

If you set the isolation level to serializable the application will work as there is no concurrency at all, but still will allow some concurrency.

The higher the isolation level, the less concurrency you have, still you have more then if you lock the table.

Maxim Krizhanovsky
  • 26,265
  • 5
  • 59
  • 89