美文网首页
max_statement_time exceeded

max_statement_time exceeded

作者: 等你足够强了再说吧 | 来源:发表于2021-12-23 17:50 被阅读0次

java.sql.SQLException: Query execution was interrupted, max_statement_time exceeded

### Cause: java.sql.SQLException: Query execution was interrupted, max_statement_time exceeded

max_statement_time作用:
作用:用于控制查询在MySQL的最长执行时间,如果超过该参数设置时间,查询将会自动失败,默认是不限制。如果在Mysql服务端更新此参数,新建立的连接立即生效。变更对已有的连接无效
建议:如果用户希望控制数据库中SQL的执行时间,则可以开启该参数,单位是毫秒。
现象:ERROR 1882: Query execution was interrupted, max_statement_time exceeded

--单位是ms,动态参数,默认值是0,代表不限制。
select @@global.max_execution_time
image.png

修改参数值:

mysql> set  session max_statement_time =0;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like '%max_statement%';
+------------------------------------------+-------+
| Variable_name                            | Value |
+------------------------------------------+-------+
| max_statement_time                       | 0     |
| performance_schema_max_statement_classes | 179   |
+------------------------------------------+-------+
--用来对精确匹配【=】场景索引的优化。即把上次等号匹配用到的索引记下来,下次就可以直接用了。
--这个办法也会占用IO,要酌情使用
innodb_adaptive_hash_index

相关文章

网友评论

      本文标题:max_statement_time exceeded

      本文链接:https://www.haomeiwen.com/subject/wrtkqrtx.html