Commit 1641da0 1 parent 0fabd91 commit 1641da0 Copy full SHA for 1641da0
File tree 1 file changed +19
-8
lines changed
1 file changed +19
-8
lines changed Original file line number Diff line number Diff line change @@ -255,14 +255,25 @@ def innodb_trx(request):
255
255
trx.trx_rows_modified,
256
256
trx.trx_is_read_only,
257
257
trx.trx_isolation_level,
258
- p.user,
259
- p.host,
260
- p.db,
261
- to_seconds(now()) - to_seconds(trx.trx_started) trx_idle_time,
262
- p.time thread_time,
263
- ifnull(p.info, '') info
264
- from information_schema.INNODB_TRX trx
265
- join information_schema.processlist p on trx.trx_mysql_thread_id = p.id;'''
258
+ p.user,
259
+ p.host,
260
+ p.db,
261
+ TO_SECONDS(NOW()) - TO_SECONDS(trx.trx_started) trx_idle_time,
262
+ p.time thread_time,
263
+ IFNULL((SELECT
264
+ GROUP_CONCAT(t1.sql_text SEPARATOR ';
265
+ ')
266
+ FROM performance_schema.events_statements_history t1
267
+ INNER JOIN performance_schema.threads t2
268
+ ON t1.thread_id = t2.thread_id
269
+ WHERE t2.PROCESSLIST_ID = p.id), '') info
270
+ FROM information_schema.INNODB_TRX trx
271
+ INNER JOIN information_schema.PROCESSLIST p
272
+ ON trx.trx_mysql_thread_id = p.id
273
+ WHERE trx.trx_state = 'RUNNING'
274
+ AND p.COMMAND = 'Sleep'
275
+ AND P.TIME > 3
276
+ ORDER BY trx.trx_started ASC;'''
266
277
267
278
query_result = query_engine .query ('information_schema' , sql )
268
279
if not query_result .error :
You can’t perform that action at this time.
0 commit comments