Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个mysql的程序:
START TRANSACTION; insert into table1(id, name) values(1, 'a'); -- id is a primary key. ... delete from table1 where id = 1; COMMIT;
并且对该过程的多线程调用将在 jdbc Duplicate entry '1' for key table1_UNIQUE_key'中显示错误
为什么其他线程不会等待这个线程结束?
这是因为如果你检查,你已经将表声明为INODB引擎,它允许行级锁,如果是MYSAM这个问题就不会发生
INODB
MYSAM