You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
YZWL/IDEA/sys/ps_setup_disable_thread.sql

43 lines
1.0 KiB

create
definer = `mysql.sys`@localhost procedure sys.ps_setup_disable_thread(IN in_connection_id bigint) comment '
Description
-----------
Disable the given connection/thread in Performance Schema.
Parameters
-----------
in_connection_id (BIGINT):
The connection ID (PROCESSLIST_ID from performance_schema.threads
or the ID shown within SHOW PROCESSLIST)
Example
-----------
mysql> CALL sys.ps_setup_disable_thread(3);
+-------------------+
| summary |
+-------------------+
| Disabled 1 thread |
+-------------------+
1 row in set (0.01 sec)
To disable the current connection:
mysql> CALL sys.ps_setup_disable_thread(CONNECTION_ID());
+-------------------+
| summary |
+-------------------+
| Disabled 1 thread |
+-------------------+
1 row in set (0.00 sec)
' sql security invoker modifies sql data
BEGIN
UPDATE performance_schema.threads
SET instrumented = 'NO'
WHERE processlist_id = in_connection_id;
SELECT CONCAT('Disabled ', @rows := ROW_COUNT(), ' thread', IF(@rows != 1, 's', '')) AS summary;
END;