Mysql Monitor High Cpu Usage in Realtime

February 24, 2021
SHOW FULL PROCESSLIST\G
*************************** 1. row ***************************
      Id: 650
    User: web
    Host: localhost:37462
      db: bot_monitor
 Command: Query
    Time: 18827
   State: Sending data
    Info: SELECT p1.*
FROM notification p1 LEFT JOIN notification p2
  ON (p1.bot_id = p2.bot_id AND p1.created < p2.created)
WHERE p2.bot_id IS NULL
Progress: 0.000
*************************** 2. row ***************************
      Id: 676
    User: web
    Host: localhost:37570
      db: bot_monitor
 Command: Query
    Time: 18527
   State: Sending data
    Info: SELECT p1.*
FROM notification p1 LEFT JOIN notification p2
  ON (p1.bot_id = p2.bot_id AND p1.created < p2.created)
WHERE p2.bot_id IS NULL
Progress: 0.000

Time indicate how long the query/process had been running.

You can kill a process via Id

KILL 650

Or kill all process by a user

KILL USER web;
This work is licensed under a
Creative Commons Attribution-NonCommercial 4.0 International License.