MySQL
keyboard_arrow_down 295 guides
chevron_leftServer settings Cookbook
check_circle
Mark as learned thumb_up
0
thumb_down
0
chat_bubble_outline
0
Comment auto_stories Bi-column layout
settings
Checking all running queries in MySQL
schedule Aug 11, 2023
Last updated local_offer
Tags MySQL
tocTable of Contents
expand_more Master the mathematics behind data science with 100+ top-tier guides
Start your free 7-days trial now!
Start your free 7-days trial now!
We can check all running queries on the MySQL server using the SHOW PROCESSLIST
command:
SHOW PROCESSLIST;
+----+-----------------+-----------+------+---------+------+------------------------+------------------+| Id | User | Host | db | Command | Time | State | Info |+----+-----------------+-----------+------+---------+------+------------------------+------------------+| 4 | event_scheduler | localhost | NULL | Daemon | 2119 | Waiting on empty queue | NULL || 8 | root | localhost | NULL | Query | 0 | starting | SHOW PROCESSLIST |+----+-----------------+-----------+------+---------+------+------------------------+------------------+
This is useful when you are trying to diagnose problems or see what users are doing.
An alternative way would be to use the following command:
SELECT * FROM information_schema.PROCESSLIST;
+----+-----------------+-----------+------+---------+------+------------------------+----------------------------------------------+| ID | USER | HOST | DB | COMMAND | TIME | STATE | INFO |+----+-----------------+-----------+------+---------+------+------------------------+----------------------------------------------+| 8 | root | localhost | NULL | Query | 0 | executing | SELECT * FROM information_schema.PROCESSLIST || 4 | event_scheduler | localhost | NULL | Daemon | 2249 | Waiting on empty queue | NULL |+----+-----------------+-----------+------+---------+------+------------------------+----------------------------------------------+
Note that the TIME
here is quoted in seconds.
Published by Arthur Yanagisawa
Edited by 0 others
Did you find this page useful?
thumb_up
thumb_down
Comment
Citation
Ask a question or leave a feedback...
thumb_up
0
thumb_down
0
chat_bubble_outline
0
settings
Enjoy our search
Hit / to insta-search docs and recipes!