Where would I set the maximum time a query will wait for a lock in MySQL 5.0.68 before timing out?
3 Answers
Other timeout settings that are general (not just for locks, since innodb_lock_wait_timeout only applies to InnoDB row locks) would be wait_timeout and interactive_timeout (both default to 28,800)
By default, it is 50 seconds
Just set innodb_lock_wait_timeout as needed.
-
-
2@Hari For MySQL 8, you can run
SET PERSIST innodb_lock_wait_timetout = 120;
. For MySQL 5.x, you can runSET GLOBAL innodb_lock_wait_timetout = 120;
and add the lineinnodb_lock_wait_timetout = 12;
under the[mysqld]
group header in your my.cnf so the value would be resused on the next restart of mysqld. Nov 18, 2020 at 16:56 -
If you hit the 50-sec InnoDB timeout, you have a poorly designed application!
That timeout exists to catch naughty things that cannot be caught any other way.
-
5Or due to errors, I've an extremely busy mysql and mariadb server and deadlocks are a normal thing ot happen all the time. Even if "impossible". If you have a hundred million rows and ten thousands of sql command every second you'll find every sort of bug in mysql (crashes) as well as deadlocks of various sorts.– JohnDec 19, 2018 at 19:15
-
5It depens to the situation. From the mysql docs: You might decrease this value for highly interactive applications or OLTP systems, to display user feedback quickly or put the update into a queue for processing later. You might increase this value for long-running back-end operations, such as a transform step in a data warehouse that waits for other large insert or update operations to finish.– g4b0Sep 5, 2019 at 7:38
-
-
This will happen in every application. You might not have enough records to make it happen yet, though. Wait until you are missing the cache all the time. Fun to pretend to be in the elite never-time-out club though. Dec 21, 2021 at 7:58
-
1@MuhammadOmerAslam - I responded to that Q. For performance issues, come to here or stackoverflow.com. I suspect "Code review" focuses on syntax, which is not the main question you have. Feb 14 at 17:35