MySQL - can I limit the maximum time allowed for a query to run?

后端 未结 4 1027
[愿得一人]
[愿得一人] 2020-11-27 19:39

I\'m looking for a way to limit the max running time of a query on mysql server. I figured this could be done through the my.cnf configuration file, but couldn\

4条回答
  •  执笔经年
    2020-11-27 20:23

    http://mysqlserverteam.com/server-side-select-statement-timeouts/

    Interesting upgrade. I will check it:

    "MySQL 5.7.4 introduces the ability to set server side execution time limits, specified in milliseconds, for top level read-only SELECT statements".

    SET GLOBAL MAX_STATEMENT_TIME=1000;
    SET SESSION MAX_STATEMENT_TIME=2000;
    SELECT MAX_STATEMENT_TIME=1000 * FROM table;
    

提交回复
热议问题