Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit e232ba7

Browse files
committed
Fix the processlist view for 5.7.5 ONLY_FULL_GROUP_BY, using the new memory_by_thread_by_current_bytes
1 parent e2391e4 commit e232ba7

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

views/p_s/processlist_57.sql

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,22 @@ SELECT pps.thread_id AS thd_id,
9393
esc.created_tmp_disk_tables AS tmp_disk_tables,
9494
IF(esc.no_good_index_used > 0 OR esc.no_index_used > 0,
9595
'YES', 'NO') AS full_scan,
96-
sys.format_bytes(SUM(mem.current_number_of_bytes_used)) AS current_memory,
96+
sys.format_bytes(mem.current_allocated) AS current_memory,
9797
IF(esc.timer_wait IS NOT NULL,
9898
sys.format_statement(esc.sql_text),
9999
NULL) AS last_statement,
100100
IF(esc.timer_wait IS NOT NULL,
101101
sys.format_time(esc.timer_wait),
102-
NULL) as last_statement_latency,
102+
NULL) AS last_statement_latency,
103103
ewc.event_name AS last_wait,
104104
IF(ewc.timer_wait IS NULL AND ewc.event_name IS NOT NULL,
105105
'Still Waiting',
106106
sys.format_time(ewc.timer_wait)) last_wait_latency,
107107
ewc.source
108108
FROM performance_schema.threads AS pps
109109
LEFT JOIN performance_schema.events_waits_current AS ewc USING (thread_id)
110-
LEFT JOIN performance_schema.events_statements_current as esc USING (thread_id)
111-
LEFT JOIN performance_schema.memory_summary_by_thread_by_event_name as mem USING (thread_id)
112-
GROUP BY thread_id
110+
LEFT JOIN performance_schema.events_statements_current AS esc USING (thread_id)
111+
LEFT JOIN sys.x$memory_by_thread_by_current_bytes AS mem USING (thread_id)
113112
ORDER BY pps.processlist_time DESC, last_wait_latency DESC;
114113

115114
/*
@@ -191,21 +190,20 @@ SELECT pps.thread_id AS thd_id,
191190
esc.created_tmp_disk_tables AS tmp_disk_tables,
192191
IF(esc.no_good_index_used > 0 OR esc.no_index_used > 0,
193192
'YES', 'NO') AS full_scan,
194-
SUM(mem.current_number_of_bytes_used) AS current_memory,
193+
mem.current_allocated AS current_memory,
195194
IF(esc.timer_wait IS NOT NULL,
196195
esc.sql_text,
197196
NULL) AS last_statement,
198197
IF(esc.timer_wait IS NOT NULL,
199198
esc.timer_wait,
200-
NULL) as last_statement_latency,
199+
NULL) AS last_statement_latency,
201200
ewc.event_name AS last_wait,
202201
IF(ewc.timer_wait IS NULL AND ewc.event_name IS NOT NULL,
203202
'Still Waiting',
204203
ewc.timer_wait) last_wait_latency,
205204
ewc.source
206205
FROM performance_schema.threads AS pps
207206
LEFT JOIN performance_schema.events_waits_current AS ewc USING (thread_id)
208-
LEFT JOIN performance_schema.events_statements_current as esc USING (thread_id)
209-
LEFT JOIN performance_schema.memory_summary_by_thread_by_event_name as mem USING (thread_id)
210-
GROUP BY thread_id
207+
LEFT JOIN performance_schema.events_statements_current AS esc USING (thread_id)
208+
LEFT JOIN sys.x$memory_by_thread_by_current_bytes AS mem USING (thread_id)
211209
ORDER BY pps.processlist_time DESC, last_wait_latency DESC;

0 commit comments

Comments
 (0)