Databases 5 min read

Decoding MySQL Processlist: Understand Columns, States, and Performance Issues

This guide explains how to use MySQL's show processlist command, interprets each column and common state values, and offers practical tips for diagnosing and resolving performance problems such as sleeping connections, locked queries, temporary tables, and query cache issues.

Java High-Performance Architecture
Java High-Performance Architecture
Java High-Performance Architecture
Decoding MySQL Processlist: Understand Columns, States, and Performance Issues

Viewing MySQL Execution Status

When MySQL performance seems degraded, start by checking the current execution status with show processlist:

+----+------+-------------------+-------+---------+------+--------+-------+
| Id | User | Host              | db    | Command | Time | State  | Info  |
+----+------+-------------------+-------+---------+------+--------+-------+
|207|root|192.168.0.2:51621|mytest|Sleep|5||NULL|
|208|root|192.168.0.2:51622|mytest|Sleep|5||NULL|
|220|root|192.168.0.2:51676|mytest|Query|84|locked|
+----+------+-------------------+-------+---------+------+--------+-------+

Column meanings

Id : Identifier of the thread; use it with kill <id> to terminate a query.

User : The account that issued the statement; non‑root users see only their own queries.

Host : IP address and port of the client, useful for tracing problematic users.

Db : Database currently selected by the thread.

Command : Type of command, e.g., Sleep, Query, Connect.

Time : Duration (in seconds) the command has been in its current state.

State : Detailed status of the executing SQL, such as Copy to tmp table, Sorting result, Sending data, etc.

Info : The actual SQL statement (truncated if long); essential for diagnosing issues.

Common State Analysis

Sleep : Indicates an idle connection; excessive sleep may mean connections are not being closed properly.

Locked : The operation is waiting for a lock; using InnoDB can reduce this occurrence.

Copy to tmp table : MySQL creates a temporary table when indexes cannot satisfy the query, causing high I/O; consider reducing joins or optimizing the query, and kill long‑running statements if needed.

Sending data : Refers to reading data from disk rather than network transmission; many such connections often mean large result sets or missing indexes.

Storing result to query cache : Frequent appearance suggests query cache fragmentation; use set profiling to analyze and flush query cache to clear, adjusting cache parameters as appropriate.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

SQLmysqlDatabase Optimizationprocesslist
Java High-Performance Architecture
Written by

Java High-Performance Architecture

Sharing Java development articles and resources, including SSM architecture and the Spring ecosystem (Spring Boot, Spring Cloud, MyBatis, Dubbo, Docker), Zookeeper, Redis, architecture design, microservices, message queues, Git, etc.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.