This is an example of selecting *
that will need to execute for more than the set timeout of 1ms
.
mysql> select * /*+ MAX_EXECUTION_TIME(1) */ from test_table;
ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded
mysql> select thread_id,event_name,sql_text,digest_text,current_schema,mysql_errno,returned_sqlstate,message_text,errors from performance_schema.events_statements_history where mysql_errno = 3024 limit 1\G
*************************** 1. row ***************************
thread_id: 345
event_name: statement/sql/select
sql_text: NULL
digest_text: SELECT /*+ MAX_EXECUTION_TIME (?) */ * FROM `test_table`
current_schema: test
mysql_errno: 3024
returned_sqlstate: HY000
message_text: Query execution was interrupted, maximum statement execution time exceeded
errors: 1
1 row in set (0.01 sec)
mysql> select @@version;
+-----------+
| @@version |
+-----------+
| 8.0.30 |
+-----------+
1 row in set (0.00 sec)
The documentation states:
For a command not associated with an SQL statement, the value is NULL. source
But as far as I can tell, this command is associated with a SQL statement, hence the event being called statement/sql/select
.