• Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.
  • This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money.

From himself in CSDN: blog.csdn.net/pmdream/art…

The default is:

Set max_execution_time=0;

Set max_statement_time=0;

But again, it depends on the version of mysql;

Mysql > update Mysql

select version();

5.7 and 5.6 are major changes;

Check to see if there is this time:

show variables like ‘max_execution_time’;

Changes in 5.6 and 5.7:

Mysql 5.6 and later has a statement execution timeout variable, which is used to limit the timeout time of select statements on the server side.

Max_statement_time (milliseconds)

Max_execution_time (milliseconds)

When this time is exceeded, mysql terminates the select statement and the client throws an exception:

The default should be to operate on sessions;

Global + global

1. Global

SET GLOBAL MAX_EXECUTION_TIME=1000;

2. Set a session

SET SESSION MAX_EXECUTION_TIME=1000;

3. Set a statement (this does not represent a comment! , it does work, some of it is wrong)

select /+ max_execution_time(10)/ count(*) FROM xxx.tablename;