wait events per thread+statement
Posted by: Yossi Nixon
Date: April 18, 2022 10:21AM

I am trying to understand why I am not catching the total waits performed by the combination of statements+thread(wait)
Any idea what is wrong with using my query?
(I already enabled the relevant instrumentation and consumers)
Mysql 5.x

select t.thread_id,
wc.event_name AS wait_event_name,
wh.event_name AS last_wait_event_name,
wc.operation AS wait_operation,
s.timer_wait AS statement_time,
wc.timer_wait AS wait_time, # IN picoseconds (trillionths of a second)
wh.timer_wait AS last_wait_time,
FROM performance_schema.threads t
INNER JOIN performance_schema.events_statements_current s
ON s.thread_id = t.thread_id
INNER JOIN performance_schema.events_waits_current AS wc
ON wc.thread_id = s.thread_id
LEFT JOIN performance_schema.events_waits_history wh
ON wc.thread_id = wh.thread_id
AND wc.nesting_event_id = wh.nesting_event_id
t.processlist_command not in ('Connect')
AND s.event_id is not null
AND t.processlist_id != connection_id()
AND s.sql_text is not null;

If I filter out processlist_command != 'Sleep' I miss many queries (I run this query every second and gather all information)

Options: ReplyQuote

Written By
wait events per thread+statement
April 18, 2022 10:21AM

Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.