Mytop Thread View Body
We now get to an interesting part of the interface which is the part that lists all the current threads and what queries, if any, they are running. The first column is the Id which tells us the id of the thread. We can use the "e" button to explain any of the thread id's. This will explain the query that is being run such that we can figure out if the query is optimized and/or if it is causing the server to slow down.
The next column is the User which tells what user the thread is connected as.
Following the User column we have the Host/IP column which tells us the hostname or the ip address the connection is coming from. This is useful to figure out which server, if not all connections are from the localhost, is accessing the server the most. Using the "h" key allows you to type in a specific host or ip address which will make mytop only show you the threads that are connected from that host or ip.
We then find the DB column which tells us the database that the thread is connected to. We need to know this because we need to know what database the query is being run against. It is possible people will have the same database schema and therefore the same sql queries running against different databases so knowing the database it connects to, along with other information, is useful for doing debugging.
Time is how long the query has been running or how long the processes has been in the specific state. It is very useful to order by time which can be done by "o" which will order and reverse order the threads based on the time. When ordered so the longest running thread is at top one can usually figure out what query it is that is making the server hang. You should then use explain "e" to explain the query that is being run to better understand why the query is taking a long time and holding up all other queries.
Cmd stands for command and can be anything from query to sleep and it stands for the state that the thread is in. If the thread is in a query state then the next column Query or State will show the first part of the query that is being run. If the command state is sleep or idle then the Query or State column will usually be blank.
View Using Mytop: A MySQL Monitor Discussion
Page: 1 2 3 4 5 Next Page: Mytop Command View