I have a long running process which import products and from time to time I get deadlock errors. According to my knowledge I thought that if during script execution I'll switch isolation level to Serializable I will solve an issue with deadlocks. But, what can I do, I can open 2 terminals and reproduce deadlock with Serializable.
conn1: SET GLOBAL TRANSACTION ISOLATION LEVEL SERIALAZIBLE; conn1: START TRANSACTION; conn2: START TRANSACTION; conn1: UPDATE core_config_data set value = 1 WHERE config_id = 1; conn2: UPDATE core_config_data set value = 1 WHERE config_id = 2; conn1: UPDATE core_config_data set value = 1 WHERE config_id = 2; waiting... conn2: UPDATE core_config_data set value = 1 WHERE config_id = 1; ERROR 1213 (40001): Deadlock found when trying to get lock; try restarting transaction Ok, after it I tried dirty reads with READ UNCOMMITED:
conn1: SET GLOBAL TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; conn1: START TRANSACTION; conn1: SELECT junk FROM employees WHERE employee_id = 1; junk=test; conn2: START TRANSACTION; conn2: update employees set junk='test1' where employee_id = 1; conn1: SELECT junk FROM employees WHERE employee_id = 1; junk=test; Do you know where I'm mistaken?