zoukankan      html  css  js  c++  java
  • MySQL事件自动kill运行时间超时的SQL

    delimiter $
    create event my_long_running_trx_monitor
    on schedule every 1 minute
    starts '2015-09-15 11:00:00'
    on completion preserve enable do
    begin
    declare v_sql varchar(500);
    declare no_more_long_running_trx integer default 0;
    declare c_tid cursor for
    select concat ('kill ',trx_mysql_thread_id,';')
    from information_schema.innodb_trx
    where timestampdiff(minute,trx_started,now()) >= 1;
    declare continue handler for not found
    set no_more_long_running_trx=1;

    open c_tid;
    repeat
    fetch c_tid into v_sql;
    set @v_sql=v_sql;
    prepare stmt from @v_sql;
    execute stmt;
    deallocate prepare stmt;
    until no_more_long_running_trx end repeat;
    close c_tid;
    end;
    $
    delimiter ;

  • 相关阅读:
    阅读笔记
    学习小记
    networkx学习笔记
    ORM查询简化
    redis等缓存
    redis相关缓存知识
    Centos7网络配置
    redis安装详细
    redis安装详细
    mobaxterm使用手册
  • 原文地址:https://www.cnblogs.com/zping/p/10895733.html
Copyright © 2011-2022 走看看