Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I execute SQL queries that take longer 99,999 seconds on MySQL Workbench?

UPDATE: the issue is now fixed.


I would like to execute a query that takes more than 99,999 seconds to execute (e.g. SELECT SLEEP(150000);). To change the timeout in MySQL Workbench, we have to go to Edit → Preferences → SQL Editor → DBMS connection read time out (in seconds). However, the DBMS connection read time out field only accept up to 5 figures, and setting the field to 0 is equivalent to the default parameter (600 seconds). If the query takes more time than the timeout, I get the error message: Error Code: 2013. Lost connection to MySQL server during query

Hence my question: is it possible to increase this limit to over 99,999 seconds? I use Windows 7 64-bit Ultimate with MySQL Workbench 5.2.47 CE.

The DBMS connection read time out field: enter image description here

Timeout issue (0 is equivalent to the default parameter (600 seconds)): enter image description here

like image 313
Franck Dernoncourt Avatar asked Jun 01 '13 21:06

Franck Dernoncourt


People also ask

How can increase query execution time limit in MySQL?

SET SESSION MAX_EXECUTION_TIME=2000; Then any SELECT statements run in this particular session are aborted if they take more than 2 seconds to complete. Finally, the maximum execution time can also be set for a specific SELECT statement using the MAX_EXECUTION_TIME hint directly in the query.

Why is my query taking so long MySQL?

Queries can become slow for various reasons ranging from improper index usage to bugs in the storage engine itself. However, in most cases, queries become slow because developers or MySQL database administrators neglect to monitor them and keep an eye on their performance.

How do I increase time in SQL Workbench?

Can I adjust the timeout? Yes, go to Preferences, SQL Editor, and adjust the DBMS connection read time out option that defaults to 600 seconds. This sets the maximum amount of time (in seconds) that a query can take before MySQL Workbench disconnects from the MySQL server.


2 Answers

Probably nobody ever thought you'd need such a high timeout, so you are limited to what is settable currently. But open a feature request on http://bugs.mysql.com to suggest either having 0 disable the timeout entirely or allow bigger values.

like image 127
Mike Lischke Avatar answered Sep 20 '22 14:09

Mike Lischke


This issue is now solved in MySQL Workbench 6.0.3 (2013-07-09): See the bug report and the change log.

like image 27
Franck Dernoncourt Avatar answered Sep 18 '22 14:09

Franck Dernoncourt