How to write SQL to calculate the total execution time of this SQL in the dashboard/#/statement?

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: dashboard/#/statement 这个sql总耗时 自己用sql怎么写

| username: tidb狂热爱好者

【TiDB Usage Environment】Production Environment
【TiDB Version】
6.5
【Reproduction Path】

dashboard/#/statement How to write this SQL for total elapsed time

Want to set up automatic alerts for SQL statements with a total elapsed time greater than 10 minutes
【Encountered Issues: Problem Phenomenon and Impact】
【Resource Configuration】
【Attachments: Screenshots/Logs/Monitoring】

| username: Raymond | Original post link

Querying the “time” field in the processlist table should be possible.

| username: 人如其名 | Original post link

| username: wzf0072 | Original post link

select * from information_schema.processlist where info is not null and time>=600
| username: Kongdom | Original post link

Pay attention to the time judgment. The original version judged two times. This is quite strange, usually judging one time is enough.

| username: xingzhenxiang | Original post link

SELECT id, info, time, mem 
FROM information_schema.processlist 
WHERE info IS NOT NULL AND time >= 600;
| username: system | Original post link

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.