SHOW PROCESSLIST

You are viewing an old version of this article. View the current version here.

Syntax

SHOW [FULL] PROCESSLIST

Description

SHOW PROCESSLIST shows you which threads are running. You can also get this information from the INFORMATION_SCHEMA.PROCESSLIST table or the mysqladmin processlist command. If you have the PROCESS privilege, you can see all threads. Otherwise, you can see only your own threads (that is, threads associated with the MariaDB account that you are using). If you do not use the FULL keyword, only the first 100 characters of each statement are shown in the Info field.

The columns shown in SHOW PROCESSLIST are:

NameDescriptionIntroduced
IDThe client's process ID.
USERThe username associated with the process.
HOSTThe host the client is connected to.
DBThe default database of the process (NULL if no default).
COMMANDThe command type. See Thread Command Values.
TIMEThe amount of time, in seconds, the process has been in its current state. For a slave SQL thread before MariaDB 10.1, this is the time in seconds between the last replicated event's timestamp and the slave machine's real time.
STATEThe state of the server.
INFOThe statement being executed.
PROGRESSThe total progress of the process (0-100%) (see Progress Reporting).MariaDB 5.3

See TIME_MS column in INFORMATION_SCHEMA.PROCESSLIST for differences in the TIME column between MariaDB and MySQL.

The INFORMATION_SCHEMA.PROCESSLIST table contains the following additional columns:

NameDescriptionIntroduced
TIME_MSThe amount of time, in milliseconds, the process has been in its current state.MariaDB 5.1
STAGEThe stage the process is currently in.MariaDB 5.3
MAX_STAGEThe maximum number of stages.MariaDB 5.3
PROGRESSThe progress of the process within the current stage (0-100%).MariaDB 5.3
MEMORY_USEDThe amount of memory used by the process.MariaDB 10.0.1
EXAMINED_ROWSThe number of rows the process has examined.MariaDB 10.0.1
QUERY_IDQuery ID.MariaDB 10.0.5

Note that the PROGRESS field from the information schema, and the PROGRESS field from SHOW PROCESSLIST display different results. SHOW PROCESSLIST shows the total progress, while the information schema shows the progress for the current stage only.

Threads can be killed using their thread_id, or, since MariaDB 10.0.5, their query_id, with the KILL statement.

Since queries on this table are locking, if the performance_schema is enabled, you may want to query the THREADS table instead.

Examples

From MariaDB 5.1.x

SHOW FULL PROCESSLIST;
+---------+-------+-----------+------+---------+------+-------+-----------------------+
| Id      | User  | Host      | db   | Command | Time | State | Info                  |
+---------+-------+-----------+------+---------+------+-------+-----------------------+
| 1988880 | dbart | localhost | NULL | Query   |    0 | NULL  | SHOW FULL PROCESSLIST |
+---------+-------+-----------+------+---------+------+-------+-----------------------+

SELECT * FROM information_schema.processlist;
+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+
| ID      | USER  | HOST      | DB   | COMMAND | TIME | STATE     | INFO                                         | TIME_MS |
+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+
| 1988880 | dbart | localhost | NULL | Query   |    0 | executing | SELECT * FROM information_schema.processlist |   0.444 |
+---------+-------+-----------+------+---------+------+-----------+----------------------------------------------+---------+

From MariaDB 5.5.x

SHOW FULL PROCESSLIST;
+-----+------+-----------+------+---------+------+-------+-----------------------+----------+
| Id  | User | Host      | db   | Command | Time | State | Info                  | Progress |
+-----+------+-----------+------+---------+------+-------+-----------------------+----------+
| 126 | root | localhost | NULL | Query   |    0 | NULL  | SHOW FULL PROCESSLIST |    0.000 |
+-----+------+-----------+------+---------+------+-------+-----------------------+----------+

SELECT * FROM information_schema.processlist;
+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+
| ID  | USER   | HOST      | DB   | COMMAND | TIME | STATE     | INFO                                         | TIME_MS | STAGE | MAX_STAGE | PROGRESS |
+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+
| 126 | root | localhost | NULL | Query   |    0 | executing | SELECT * FROM information_schema.processlist | 344.718 |     0 |         0 |    0.000 |
+-----+--------+-----------+------+---------+------+-----------+----------------------------------------------+---------+-------+-----------+----------+

From MariaDB 10.0.x

SHOW PROCESSLIST;
+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+
| Id | User            | Host      | db   | Command | Time | State                  | Info             | Progress |
+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+
|  2 | event_scheduler | localhost | NULL | Daemon  | 2693 | Waiting on empty queue | NULL             |    0.000 |
|  4 | root            | localhost | NULL | Query   |    0 | Table lock             | SHOW PROCESSLIST |    0.000 |
+----+-----------------+-----------+------+---------+------+------------------------+------------------+----------+

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.