Let's assume that we have the following tables on an InnoDB database:
- user (id_user, name)
- log (id_log, id_user, info)
- message (id_message, id_user_from, id_user_to, message)
id_user column on
message tables are FK to
As I understand it, when we make an insert on
log table mysql will create a shared lock on the related record on
user, if exists. If another transaction try to get a shared lock, it will works fine. If another transaction try to get a exclusive lock, it will have to wait until the first transaction finishes.
My question is: If another transaction try to make an insert or update on
message referencing the same record on
user it will be impacted by the insert on
log? I don't think so, because this transaction will get a shared lock on the record too, but I read on some old articles (from 10 years ago) that this can be an issue. If it is a case, isolation level has some impact on this? Again, I don't think so.