mysql設置查詢超時
mysql 5.6 中,名為: max_statement_time (毫秒)
5.7 使用 max_execution_time(毫秒)
例如設置10秒超時
mysql> set max_execution_time =10000; Query OK, 0 rows affected (0.00 sec)
查詢一個耗時久的查詢得到
ERROR 1028 (HY000): Sort aborted: Query execution was interrupted, maximum statement execution time exceeded
這樣能從mysql避免那種耗時查詢