Querious Help 5

Server Processes view — MySQL

Who is connected, and what each connection is doing right now.

The Processes view is SHOW PROCESSLIST made usable: every client connection, what it's running, for how long, and the commands to stop it. It refreshes automatically and charts connection counts while you watch. It's the first place to look when the server feels slow or connections pile up.

The Processes view
The Processes view

The List #

Column What it shows
id The processlist ID: the number KILL takes, and the Conn and Blocked By number in Locks.
User The MySQL user it authenticated as.
Host Where it connected from, with port.
Database Its currently selected database.
Command Query is executing a statement; Sleep is connected and idle.
Time The number of seconds in the current command: idle time for a sleeping connection, run time for a query.
State The server's description of the statement's phase ("Sending data", "Waiting for table metadata lock", "Copying to tmp table"). Often the most informative column.
Query The statement text. Select a row to read the whole statement in the Current Query pane below the list. Turn off Show Full Query in the bottom bar to have the server shorten long statements.

Reducing the Noise #

Most connections are asleep in a connection pool. Choose Hide from the menu beside Sleeping above the chart to remove them from the list (the setting is remembered).

The play/pause button in the bottom bar stops the automatic refresh. Pause it to read a row without the list reordering, or to study a State value.

Stopping Work #

The commands to stop work are in the action menu in the bottom bar and in a row's contextual menu. Both menus apply a command to every selected row, and the commands are disabled when nothing is selected. On Amazon RDS, Querious uses RDS's mysql.rds_kill and mysql.rds_kill_query procedures instead.

Command What it does
Stop Query KILL QUERY: cancels the running statement and leaves the connection open. Its transaction stays open too, along with any locks.
Kill Connection KILL CONNECTION: ends the session, rolls back its transaction, and releases its locks.

Acting on other users' connections requires PROCESS and SUPER (or CONNECTION_ADMIN on newer versions).

Recipes #

To stop a query that's running far too long

  1. Choose Hide from the Sleeping menu above the chart, and sort by Time descending.

    The longest-running queries are now at the top.

  2. Check the State of a long-running query.

    If it says something like "Sending data", the server is working on it and it's just slow. If it starts with "Waiting for", it's stuck behind another connection and isn't doing any work. Stopping it won't help, so find the connection holding it up in Locks.

  3. Stop or Kill the Query.

    If it's working and has been running much longer than it should, select it and choose Stop Query. Choose Kill Connection instead only if you also need to end the session and roll back its transaction.

To diagnose "too many connections"

  1. Watch the chart with sleeping connections shown.

    If Sleeping keeps climbing while Working stays flat, connections are being opened and then left idle, which usually means an application isn't returning them to its connection pool.

  2. Compare the connection count to the server's limit.

    Count the rows in the list and compare that to max_connections in Variables. Peak Connections in Server Status is the most connections the server has had at once. If it equals the limit, new connections have been refused.

  3. Sort by Time.

    Sleeping connections that have been idle for hours were probably never closed by the application (a leak). Many recent, busy connections mean real load instead.

  4. Find out who owns the connections.

    Use User and Host to see which application or machine they belong to.

To find out what a stuck connection is waiting for

  1. Pause the refresh and read State. "Waiting for…" names the thing it wants.
  2. For a metadata lock, the blocker is usually an open transaction on the same table. Find it in Locks or InnoDB Status.
  3. For a MyISAM table lock, the blocker is whatever is writing to the table.