-
Notifications
You must be signed in to change notification settings - Fork 111
ps_thread_stack()
xiaoboluo768 edited this page Jun 9, 2020
·
3 revisions
-
在events_statements_history_long、events_waits_history_long、events_stages_history_long表中查询并返回指定内部线程ID的事件信息(json格式返回),可以把这些事件信息看作是该指定内部线程ID堆信息
-
参数:
- in_thread_id BIGINT:要跟踪堆信息的内部线程ID。该值对应performance_schema.threads表的THREAD_ID列值
- in_verbose BOOLEAN:是否在输出的事件堆信息中包含事件的instruments所在的源文件名和代码行号信息
-
返回值:一个LONGTEXT CHARACTER SET latin1长字符串值
-
定义语句
DROP FUNCTION IF EXISTS ps_thread_stack;
DELIMITER $$
CREATE DEFINER='root'@'localhost' FUNCTION ps_thread_stack (
thd_id BIGINT UNSIGNED,
debug BOOLEAN
)
RETURNS LONGTEXT CHARSET latin1
COMMENT '
Description
-----------
Outputs a JSON formatted stack of all statements, stages and events
within Performance Schema for the specified thread.
Parameters
-----------
thd_id (BIGINT UNSIGNED):
The id of the thread to trace. This should match the thread_id
column from the performance_schema.threads table.
in_verbose (BOOLEAN):
Include file:lineno information in the events.
Example
-----------
(line separation added for output)
mysql> SELECT sys.ps_thread_stack(37, FALSE) AS thread_stack\\G
*************************** 1. row ***************************
thread_stack: {"rankdir": "LR","nodesep": "0.10","stack_created": "2014-02-19 13:39:03",
"mysql_version": "5.7.3-m13","mysql_user": "root@localhost","events":
[{"nesting_event_id": "0", "event_id": "10", "timer_wait": 256.35, "event_info":
"sql/select", "wait_info": "select @@version_comment limit 1\\nerrors: 0\\nwarnings: 0\\nlock time:
...
'
SQL SECURITY INVOKER
NOT DETERMINISTIC
READS SQL DATA
BEGIN
DECLARE json_objects LONGTEXT;
/*!50602
-- Do not track the current thread, it will kill the stack
UPDATE performance_schema.threads
SET instrumented = 'NO'
WHERE processlist_id = CONNECTION_ID();
*/
SET SESSION group_concat_max_len=@@global.max_allowed_packet;
-- Select the entire stack of events
SELECT GROUP_CONCAT(CONCAT( '{'
, CONCAT_WS( ', '
, CONCAT('"nesting_event_id": "', IF(nesting_event_id IS NULL, '0', nesting_event_id), '"')
, CONCAT('"event_id": "', event_id, '"')
-- Convert from picoseconds to microseconds
, CONCAT( '"timer_wait": ', ROUND(timer_wait/1000000, 2))
, CONCAT( '"event_info": "'
, CASE
WHEN event_name NOT LIKE 'wait/io%' THEN REPLACE(SUBSTRING_INDEX(event_name, '/', -2), '\\', '\\\\')
WHEN event_name NOT LIKE 'wait/io/file%' OR event_name NOT LIKE 'wait/io/socket%' THEN REPLACE(SUBSTRING_INDEX(event_name, '/', -4), '\\', '\\\\')
ELSE event_name
END
, '"'
)
-- Always dump the extra wait information gathered for statements
, CONCAT( '"wait_info": "', IFNULL(wait_info, ''), '"')
-- If debug is enabled, add the file:lineno information for waits
, CONCAT( '"source": "', IF(true AND event_name LIKE 'wait%', IFNULL(wait_info, ''), ''), '"')
-- Depending on the type of event, name it appropriately
, CASE
WHEN event_name LIKE 'wait/io/file%' THEN '"event_type": "io/file"'
WHEN event_name LIKE 'wait/io/table%' THEN '"event_type": "io/table"'
WHEN event_name LIKE 'wait/io/socket%' THEN '"event_type": "io/socket"'
WHEN event_name LIKE 'wait/synch/mutex%' THEN '"event_type": "synch/mutex"'
WHEN event_name LIKE 'wait/synch/cond%' THEN '"event_type": "synch/cond"'
WHEN event_name LIKE 'wait/synch/rwlock%' THEN '"event_type": "synch/rwlock"'
WHEN event_name LIKE 'wait/lock%' THEN '"event_type": "lock"'
WHEN event_name LIKE 'statement/%' THEN '"event_type": "stmt"'
WHEN event_name LIKE 'stage/%' THEN '"event_type": "stage"'
WHEN event_name LIKE '%idle%' THEN '"event_type": "idle"'
ELSE ''
END
)
, '}'
)
ORDER BY event_id ASC SEPARATOR ',') event
INTO json_objects
FROM (
/*!50600
-- Select all statements, with the extra tracing information available
(SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id,
CONCAT(sql_text, '\\n',
'errors: ', errors, '\\n',
'warnings: ', warnings, '\\n',
'lock time: ', ROUND(lock_time/1000000, 2),'us\\n',
'rows affected: ', rows_affected, '\\n',
'rows sent: ', rows_sent, '\\n',
'rows examined: ', rows_examined, '\\n',
'tmp tables: ', created_tmp_tables, '\\n',
'tmp disk tables: ', created_tmp_disk_tables, '\\n',
'select scan: ', select_scan, '\\n',
'select full join: ', select_full_join, '\\n',
'select full range join: ', select_full_range_join, '\\n',
'select range: ', select_range, '\\n',
'select range check: ', select_range_check, '\\n',
'sort merge passes: ', sort_merge_passes, '\\n',
'sort rows: ', sort_rows, '\\n',
'sort range: ', sort_range, '\\n',
'sort scan: ', sort_scan, '\\n',
'no index used: ', IF(no_index_used, 'TRUE', 'FALSE'), '\\n',
'no good index used: ', IF(no_good_index_used, 'TRUE', 'FALSE'), '\\n'
) AS wait_info
FROM performance_schema.events_statements_history_long WHERE thread_id = thd_id)
UNION
-- Select all stages
(SELECT thread_id, event_id, event_name, timer_wait, timer_start, nesting_event_id, null AS wait_info
FROM performance_schema.events_stages_history_long WHERE thread_id = thd_id)
UNION */
-- Select all events, adding information appropriate to the event
(SELECT thread_id, event_id,
CONCAT(event_name ,
IF(event_name NOT LIKE 'wait/synch/mutex%', IFNULL(CONCAT(' - ', operation), ''), ''),
IF(number_of_bytes IS NOT NULL, CONCAT(' ', number_of_bytes, ' bytes'), ''),
IF(event_name LIKE 'wait/io/file%', '\\n', ''),
IF(object_schema IS NOT NULL, CONCAT('\\nObject: ', object_schema, '.'), ''),
IF(object_name IS NOT NULL,
IF (event_name LIKE 'wait/io/socket%',
-- Print the socket if used, else the IP:port as reported
CONCAT(IF (object_name LIKE ':0%', @@socket, object_name)),
object_name),
''),
/*!50600 IF(index_name IS NOT NULL, CONCAT(' Index: ', index_name), ''),*/'\\n'
) AS event_name,
timer_wait, timer_start, nesting_event_id, source AS wait_info
FROM performance_schema.events_waits_history_long WHERE thread_id = thd_id)) events
ORDER BY event_id;
RETURN CONCAT('{',
CONCAT_WS(',',
'"rankdir": "LR"',
'"nodesep": "0.10"',
CONCAT('"stack_created": "', NOW(), '"'),
CONCAT('"mysql_version": "', VERSION(), '"'),
CONCAT('"mysql_user": "', CURRENT_USER(), '"'),
CONCAT('"events": [', IFNULL(json_objects,''), ']')
),
'}');
END$$
DELIMITER ;
- 示例
root@localhost : (none) 02:45:39> SELECT sys.ps_thread_stack(50, FALSE) AS thread_stack\G;
*************************** 1. row ***************************
thread_stack: {"rankdir": "LR","nodesep": "0.10","stack_created": "2017-09-09 14:47:50","mysql_version": "5.7.18-log","mysql_user": "root@%","events": [{"nesting_event_id": "0", "event_id": "8", \
"timer_wait": 57.59, "event_info": "sql/commit", "wait_info": "commit\nerrors: 0\nwarnings: 0\nlock time: 0.00us\nrows affected: 0\nrows sent: 0\nrows examined: 0\ntmp tables: 0\ntmp disk tables: \
0\nselect scan: 0\nselect full join: 0\nselect full range join: 0\nselect range: 0\nselect range check: 0\nsort merge passes: 0\nsort rows: 0\nsort range: 0\nsort scan: 0\nno index used: FALSE\nno good index used: \
FALSE\n", "source": "", "event_type": "stmt"},{"nesting_event_id": "8", "event_id": "9", "timer_wait": 40.71, "event_info": "sql/starting", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "9",\
"event_id": "10", "timer_wait": 1.43, "event_info": "io/socket/sql/client_connection - recv 7 bytes::ffff:127.0.0.1:37250 \\n", "wait_info": "viosocket.c:123", "source": "viosocket.c:123", "event_type": "io/socket"},\
{"nesting_event_id": "9", "event_id": "11", "timer_wait": 0.32, "event_info": "sql/THD::LOCK_thd_data\\n", "wait_info": "sql_class.h:4291", "source": "sql_class.h:4291", "event_type": "synch/mutex"},{"nesting_event_id":\
"9", "event_id": "12", "timer_wait": 0.04, "event_info": "sql/THD::LOCK_thd_query\\n", "wait_info": "sql_class.cc:4320", "source": "sql_class.cc:4320", "event_type": "synch/mutex"},{"nesting_event_id": "9", "event_id": \
"13", "timer_wait": 0.11, "event_info": "sql/THD::LOCK_query_plan\\n", "wait_info": "sql_class.h:1694", "source": "sql_class.h:1694", "event_type": "synch/mutex"},{"nesting_event_id": "9", "event_id": "14", \
"timer_wait": 0.02, "event_info": "innodb/trx_mutex\\n", "wait_info": "trx0trx.h:1475", "source": "trx0trx.h:1475", "event_type": "synch/mutex"},{"nesting_event_id": "9", "event_id": "15", "timer_wait": 0.02, "event_info": \
"innodb/trx_mutex\\n", "wait_info": "trx0trx.h:1444", "source": "trx0trx.h:1444", "event_type": "synch/mutex"},{"nesting_event_id": "9", "event_id": "16", "timer_wait": 0.02, "event_info": "innodb/trx_mutex\\n", "wait_info": \
"lock0lock.cc:6720", "source": "lock0lock.cc:6720", "event_type": "synch/mutex"},{"nesting_event_id": "9", "event_id": "17", "timer_wait": 0.02, "event_info": "innodb/trx_mutex\\n", "wait_info": "trx0trx.cc:2059", "source": \
"trx0trx.cc:2059", "event_type": "synch/mutex"},{"nesting_event_id": "9", "event_id": "18", "timer_wait": 0.02, "event_info": "innodb/trx_mutex\\n", "wait_info": "trx0trx.h:1510", "source": "trx0trx.h:1510", "event_type": \
"synch/mutex"},{"nesting_event_id": "8", "event_id": "19", "timer_wait": 2.02, "event_info": "sql/query end", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "19", "event_id": "20", "timer_wait": 0.03, \
"event_info": "sql/THD::LOCK_query_plan\\n", "wait_info": "sql_class.h:1694", "source": "sql_class.h:1694", "event_type": "synch/mutex"},{"nesting_event_id": "8", "event_id": "21", "timer_wait": 1.21, "event_info": \
"sql/closing tables", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "8", "event_id": "22", "timer_wait": 11.87, "event_info": "sql/freeing items", "wait_info": "", "source": "", "event_type": "stage"},\
{"nesting_event_id": "22", "event_id": "23", "timer_wait": 7.31, "event_info": "io/socket/sql/client_connection - send 11 bytes::ffff:127.0.0.1:37250 \\n", "wait_info": "viosocket.c:201", "source": "viosocket.c:201", \
"event_type": "io/socket"},{"nesting_event_id": "8", "event_id": "24", "timer_wait": 0.56, "event_info": "sql/cleaning up", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "24", "event_id": "25", \
"timer_wait": 0.04, "event_info": "sql/THD::LOCK_thd_query\\n", "wait_info": "sql_class.cc:4320", "source": "sql_class.cc:4320", "event_type": "synch/mutex"},{"nesting_event_id": "0", "event_id": "26", "timer_wait": \
1199058.00, "event_info": "idle - idle\\n", "wait_info": "socket_connection.cc:69", "source": "", "event_type": "idle"},{"nesting_event_id": "0", "event_id": "27", "timer_wait": 53.36, "event_info": "sql/begin", "wait_info": \
"begin\nerrors: 0\nwarnings: 0\nlock time: 0.00us\nrows affected: 0\nrows sent: 0\nrows examined: 0\ntmp tables: 0\ntmp disk tables: 0\nselect scan: 0\nselect full join: 0\nselect full range join: 0\nselect range: \
0\nselect range check: 0\nsort merge passes: 0\nsort rows: 0\nsort range: 0\nsort scan: 0\nno index used: FALSE\nno good index used: FALSE\n", "source": "", "event_type": "stmt"},{"nesting_event_id": "27",\
"event_id": "28", "timer_wait": 31.64, "event_info": "sql/starting", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "28", "event_id": "29", "timer_wait": 1.21, "event_info":\
"io/socket/sql/client_connection - recv 6 bytes::ffff:127.0.0.1:37250 \\n", "wait_info": "viosocket.c:123", "source": "viosocket.c:123", "event_type": "io/socket"},{"nesting_event_id": "28", "event_id": "30", \
"timer_wait": 0.24, "event_info": "sql/THD::LOCK_thd_data\\n", "wait_info": "sql_class.h:4291", "source": "sql_class.h:4291", "event_type": "synch/mutex"},{"nesting_event_id": "28", "event_id": "31", \
"timer_wait": 0.05, "event_info": "sql/THD::LOCK_thd_query\\n", "wait_info": "sql_class.cc:4320", "source": "sql_class.cc:4320", "event_type": "synch/mutex"},{"nesting_event_id": "28", "event_id": "32",\
"timer_wait": 0.29, "event_info": "sql/THD::LOCK_query_plan\\n", "wait_info": "sql_class.h:1694", "source": "sql_class.h:1694", "event_type": "synch/mutex"},{"nesting_event_id": "27", "event_id": "34", \
"timer_wait": 4.23, "event_info": "sql/query end", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "34", "event_id": "35", "timer_wait": 0.08, "event_info": "sql/THD::LOCK_query_plan\\n",\
"wait_info": "sql_class.h:1694", "source": "sql_class.h:1694", "event_type": "synch/mutex"},{"nesting_event_id": "27", "event_id": "36", "timer_wait": 1.11, "event_info": "sql/closing tables", "wait_info": "", "source": "", \
"event_type": "stage"},{"nesting_event_id": "27", "event_id": "37", "timer_wait": 13.95, "event_info": "sql/freeing items", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "37", "event_id": "38", \
"timer_wait": 8.33, "event_info": "io/socket/sql/client_connection - send 11 bytes::ffff:127.0.0.1:37250 \\n", "wait_info": "viosocket.c:201", "source": "viosocket.c:201", "event_type": "io/socket"},{"nesting_event_id": "27", \
"event_id": "39", "timer_wait": 0.87, "event_info": "sql/cleaning up", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "39", "event_id": "40", "timer_wait": 0.04, "event_info":\
"sql/THD::LOCK_thd_query\\n", "wait_info": "sql_class.cc:4320", "source": "sql_class.cc:4320", "event_type": "synch/mutex"},{"nesting_event_id": "0", "event_id": "41", "timer_wait": 3031847.00, \
"event_info": "idle - idle\\n", "wait_info": "socket_connection.cc:69", "source": "", "event_type": "idle"},{"nesting_event_id": "33", "event_id": "42", "timer_wait": 544.65, "event_info": "sql/select", "wait_info": "select * from\
t_luoxiaobo limit 200\nerrors: 0\nwarnings: 0\nlock time: 342.00us\nrows affected: 0\nrows sent: 200\nrows examined: 200\ntmp tables: 0\ntmp disk tables: 0\nselect scan: 1\nselect full join: 0\nselect full range join: \
0\nselect range: 0\nselect range check: 0\nsort merge passes: 0\nsort rows: 0\nsort range: 0\nsort scan: 0\nno index used: TRUE\nno good index used: FALSE\n", "source": "", "event_type": "stmt"},\
{"nesting_event_id": "42", "event_id": "43", "timer_wait": 48.72, "event_info": "sql/starting", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "43", "event_id": "44", "timer_wait": 1.25,\
"event_info": "io/socket/sql/client_connection - recv 36 bytes::ffff:127.0.0.1:37250 \\n", "wait_info": "viosocket.c:123", "source": "viosocket.c:123", "event_type": "io/socket"},{"nesting_event_id": "43", \
"event_id": "45", "timer_wait": 0.32, "event_info": "sql/THD::LOCK_thd_data\\n", "wait_info": "sql_class.h:4291", "source": "sql_class.h:4291", "event_type": "synch/mutex"},{"nesting_event_id": "43", \
"event_id": "46", "timer_wait": 0.04, "event_info": "sql/THD::LOCK_thd_query\\n", "wait_info": "sql_class.cc:4320", "source": "sql_class.cc:4320", "event_type": "synch/mutex"},{"nesting_event_id": "43",\
"event_id": "47", "timer_wait": 0.11, "event_info": "sql/THD::LOCK_query_plan\\n", "wait_info": "sql_class.h:1694", "source": "sql_class.h:1694", "event_type": "synch/mutex"},{"nesting_event_id": "42",\
"event_id": "48", "timer_wait": 4.24, "event_info": "sql/checking permissions", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "48", "event_id": "49", "timer_wait": 0.26, "event_info": \
"sql/LOCK_grant - read_lock\\n", "wait_info": "partitioned_rwlock.h:79", "source": "partitioned_rwlock.h:79", "event_type": "synch/rwlock"},{"nesting_event_id": "42", "event_id": "50", "timer_wait": 271.90, "event_info": \
"sql/Opening tables", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "50", "event_id": "51", "timer_wait": 0.21, "event_info": "sql/LOCK_table_cache\\n", "wait_info": "table_cache.h:115", "source": \
"table_cache.h:115", "event_type": "synch/mutex"},{"nesting_event_id": "50", "event_id": "52", "timer_wait": 0.03, "event_info": "sql/THD::LOCK_thd_data\\n", "wait_info": "sql_class.h:4302", "source": "sql_class.h:4302", \
"event_type": "synch/mutex"},{"nesting_event_id": "42", "event_id": "53", "timer_wait": 18.00, "event_info": "sql/init", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "53", "event_id": "54", "timer_wait": \
0.10, "event_info": "innodb/trx_mutex\\n", "wait_info": "trx0trx.h:1475", "source": "trx0trx.h:1475", "event_type": "synch/mutex"},{"nesting_event_id": "53", "event_id": "55", "timer_wait": 0.02, "event_info": \
"innodb/trx_mutex\\n", "wait_info": "trx0trx.h:1510", "source": "trx0trx.h:1510", "event_type": "synch/mutex"},{"nesting_event_id": "42", "event_id": "56", "timer_wait": 6.53, "event_info": "sql/System lock",\
"wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "56", "event_id": "57", "timer_wait": 1.66, "event_info": "sql/handler - read external\\nObject: luoxiaobo.t_luoxiaobo Index: PRIMARY\\n",\
"wait_info": "handler.cc:7893", "source": "handler.cc:7893", "event_type": "lock"},{"nesting_event_id": "57", "event_id": "58", "timer_wait": 0.06, "event_info": "innodb/trx_mutex\\n", "wait_info": "trx0trx.h:1475", \
"source": "trx0trx.h:1475", "event_type": "synch/mutex"},{"nesting_event_id": "57", "event_id": "59", "timer_wait": 0.02, "event_info": "innodb/trx_mutex\\n", "wait_info": "trx0trx.h:1510", "source": "trx0trx.h:1510", \
"event_type": "synch/mutex"},{"nesting_event_id": "57", "event_id": "60", "timer_wait": 0.03, "event_info": "innodb/trx_mutex\\n", "wait_info": "trx0trx.h:1475", "source": "trx0trx.h:1475", "event_type": "synch/mutex"},\
{"nesting_event_id": "56", "event_id": "61", "timer_wait": 0.03, "event_info": "sql/THD::LOCK_query_plan\\n", "wait_info": "sql_class.h:1694", "source": "sql_class.h:1694", "event_type": "synch/mutex"},\
{"nesting_event_id": "42", "event_id": "62", "timer_wait": 1.72, "event_info": "sql/optimizing", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "42", "event_id": "63", "timer_wait": 9.14, \
"event_info": "sql/statistics", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "42", "event_id": "64", "timer_wait": 7.79, "event_info": "sql/preparing", "wait_info": "", "source": "",\
"event_type": "stage"},{"nesting_event_id": "64", "event_id": "65", "timer_wait": 0.05, "event_info": "sql/THD::LOCK_query_plan\\n", "wait_info": "sql_class.h:1694", "source": "sql_class.h:1694", "event_type":\
"synch/mutex"},{"nesting_event_id": "42", "event_id": "66", "timer_wait": 0.40, "event_info": "sql/executing", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "42", "event_id": "67",\
"timer_wait": 140.69, "event_info": "sql/Sending data", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "67", "event_id": "68", "timer_wait": 125.16, "event_info": "io/table/sql/handler - fetch 200 \
bytes\\nObject: luoxiaobo.t_luoxiaobo\\n", "wait_info": "handler.cc:2947", "source": "handler.cc:2947", "event_type": "io/table"},{"nesting_event_id": "68", "event_id": "69", "timer_wait": 0.05, "event_info": \
"innodb/trx_sys_mutex\\n", "wait_info": "read0read.cc:584", "source": "read0read.cc:584", "event_type": "synch/mutex"},{"nesting_event_id": "68", "event_id": "70", "timer_wait": 0.22, "event_info":\
"innodb/index_tree_rw_lock - shared_lock\\n", "wait_info": "btr0cur.cc:2216", "source": "btr0cur.cc:2216", },{"nesting_event_id": "68", "event_id": "71", "timer_wait": 0.22, "event_info": \
"innodb/hash_table_locks - shared_lock\\n", "wait_info": "buf0buf.cc:4107", "source": "buf0buf.cc:4107", },{"nesting_event_id": "68", "event_id": "72", "timer_wait": 0.11, "event_info": \
"innodb/hash_table_locks - shared_lock\\n", "wait_info": "buf0buf.cc:4107", "source": "buf0buf.cc:4107", },{"nesting_event_id": "68", "event_id": "73", "timer_wait": 0.12, "event_info": \
"innodb/hash_table_locks - shared_lock\\n", "wait_info": "buf0buf.cc:4107", "source": "buf0buf.cc:4107", },{"nesting_event_id": "68", "event_id": "74", "timer_wait": 0.06, "event_info": \
"innodb/hash_table_locks - shared_lock\\n", "wait_info": "buf0buf.cc:4107", "source": "buf0buf.cc:4107", },{"nesting_event_id": "67", "event_id": "75", "timer_wait": 0.12, "event_info": "innodb/trx_mutex\\n", \
"wait_info": "trx0trx.h:1510", "source": "trx0trx.h:1510", "event_type": "synch/mutex"},{"nesting_event_id": "67", "event_id": "76", "timer_wait": 0.02, "event_info": "innodb/trx_sys_mutex\\n", "wait_info": \
"ha_innodb.cc:15683", "source": "ha_innodb.cc:15683", "event_type": "synch/mutex"},{"nesting_event_id": "42", "event_id": "77", "timer_wait": 1.82, "event_info": "sql/end", "wait_info": "", "source": "", \
"event_type": "stage"},{"nesting_event_id": "42", "event_id": "78", "timer_wait": 4.42, "event_info": "sql/query end", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "78", "event_id":\
"79", "timer_wait": 0.10, "event_info": "sql/THD::LOCK_query_plan\\n", "wait_info": "sql_class.h:1694", "source": "sql_class.h:1694", "event_type": "synch/mutex"},{"nesting_event_id": "78", "event_id": \
"80", "timer_wait": 0.08, "event_info": "innodb/trx_mutex\\n", "wait_info": "trx0trx.h:1475", "source": "trx0trx.h:1475", "event_type": "synch/mutex"},{"nesting_event_id": "78", "event_id": "81", "timer_wait":\
0.02, "event_info": "innodb/trx_mutex\\n", "wait_info": "trx0trx.h:1510", "source": "trx0trx.h:1510", "event_type": "synch/mutex"},{"nesting_event_id": "42", "event_id": "82", "timer_wait": 4.07, "event_info": \
"sql/closing tables", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "82", "event_id": "83", "timer_wait": 0.03, "event_info": "sql/THD::LOCK_thd_data\\n", "wait_info": "sql_base.cc:1746", \
"source": "sql_base.cc:1746", "event_type": "synch/mutex"},{"nesting_event_id": "82", "event_id": "84", "timer_wait": 0.03, "event_info": "sql/LOCK_table_cache\\n", "wait_info": "table_cache.h:115", "source": \
"table_cache.h:115", "event_type": "synch/mutex"},{"nesting_event_id": "42", "event_id": "85", "timer_wait": 23.14, "event_info": "sql/freeing items", "wait_info": "", "source": "", "event_type": "stage"},\
{"nesting_event_id": "85", "event_id": "86", "timer_wait": 16.88, "event_info": "io/socket/sql/client_connection - send 6454 bytes::ffff:127.0.0.1:37250 \\n", "wait_info": "viosocket.c:201", "source": "viosocket.c:201", \
"event_type": "io/socket"},{"nesting_event_id": "42", "event_id": "87", "timer_wait": 0.81, "event_info": "sql/cleaning up", "wait_info": "", "source": "", "event_type": "stage"},{"nesting_event_id": "87", "event_id": \
"88", "timer_wait": 0.06, "event_info": "sql/THD::LOCK_thd_query\\n", "wait_info": "sql_class.cc:4320", "source": "sql_class.cc:4320", "event_type": "synch/mutex"}]}
1 row in set (0.00 sec)
上一篇: ps_thread_id()函数 | 下一篇: ps_thread_trx_info()函数
- 验证、测试、整理:罗小波
- QQ:309969177
- 提示:本系列文章的主体结构遵循Oracle MySQL 官方 5.7 手册中,关于information_schema、mysql schema、performance_schema、sys schema的章节结构体系,并额外添加了一些验证、测试数据。鉴于本人精力和能力有限,难免出现一些纰漏,欢迎大家踊跃指正!