How can I stop a MySQL query if it takes too long?

后端 未结 9 1595
野趣味
野趣味 2020-12-02 09:22

Is it possible to timeout a query in MySQL?

That is, if any query exceeds the time I specify, it will be killed by MySQL and it will return an error instead of waiti

9条回答
  •  情书的邮戳
    2020-12-02 09:38

    The MySQL forum has some threads about this.

    This post details how to set up timeouts on the server using innodb_lock_wait_timeout.

    Here's a way to do it programmatically, assuming you're using JDBC.

提交回复
热议问题