info@techdevops.com | 437-991-3573 | Data Engineering Services
TechDevOps.com
Resources Tools
Experts in Microsoft SQL Server on Windows, Linux, Containers | Clusters, Always On, FCI | Migrations, Cloud, Performance



View queries executing in MySQL
by BF (Principal Consultant; Architecture; Engineering)
2015-08-22








Solution #1:

[root@ ~]# mysqladmin -uroot -p -i 1 processlist --verbose


-i 1
interval of one second

processlist
Show a list of active server threads. This is like the output of the SHOW PROCESSLIST statement. If the --verbose option is given, the output is like that of SHOW FULL PROCESSLIST

--verbose
Verbose mode. Print more information about what the program does.

Note: To exit, type ctrl c


Solution #2:

mysql> show full processlist;



Image 1:



Command
The type of command the thread is executing.

Time
The time in seconds that the thread has been in its current state.

State
An action, event, or state that indicates what the thread is doing. Most states correspond to very quick operations. If a thread stays in a given state for many seconds, there might be a problem that needs to be investigated.

Info
The statement the thread is executing, or NULL if it is not executing any statement.



Note:
Using ProcessList to view all queries may be difficult as fast queries may be missed.
To capture ALL queries use the General Query Log. This is not recommended for Production usage. However, if enabled monitor performance & disk space closely as this process can fill the log file quickly.


Resources:

SHOW PROCESSLIST Syntax

Examining Thread Information

Thread Command Values

Download MySQL Proxy

The General Query Log
...Use tail -f to view latest activity

The Slow Query Log