My Blog

contains PHP and other web related content. (Sometimes there are some off topic things - don't freak out!)

Quick Reference: Simple MySQL Performance Monitoring

There are a few quick ways to monitor MySQL performance. This isn’t much of an in-depth reference, just a quick reminder. Lets look:

mysqladmin status

Shows a quick status:

mysqladmin status
Uptime: 102594  Threads: 1  Questions: 39  Slow queries: 0  Opens: 12  Flush tables: 1  Open tables: 0  Queries per second avg: 0.000

mysqladmin processlist

Show the active processes and what they’re doing:

mysqladmin processlist
+----+------+----------------+----+---------+------+-------+------------------+
| Id | User | Host           | db | Command | Time | State | Info             |
+----+------+----------------+----+---------+------+-------+------------------+
| 25 | root | localhost:3185 |    | Query   | 0    |       | show processlist |
+----+------+----------------+----+---------+------+-------+------------------+

mysqladmin extended

This is short for extended-status, which shows you pretty much everything you want to know about the current system.

mysqladmin extended
+-----------------------------------+----------+
| Variable_name                     | Value    |
+-----------------------------------+----------+
| Aborted_clients                   | 0        |
| Aborted_connects                  | 8        |
| Binlog_cache_disk_use             | 0        |
| Binlog_cache_use                  | 0        |

| Threads_connected                 | 1        |
| Threads_created                   | 1        |
| Threads_running                   | 1        |
| Uptime                            | 102658   |
+-----------------------------------+----------+

Add iterations or relative comparisons with ‘-i’ and ‘-r’. For example, the following updates the list every 10 seconds with relative numbers (shows change well).

mysqladmin extended -i10 -r

Other Resources

MySQL.com’s explanation of some performance monitoring options
MyTop – top clone for mysql

Tags:

3 Responses to “Quick Reference: Simple MySQL Performance Monitoring”

  1. Aaron, you may like to attend my session at the upcoming MySQL Conference in Santa Clara
    MySQL Monitoring 101 – Simple Stuff to save your bacon.
    http://en.oreilly.com/mysql2009/public/schedule/detail/6933

    If you are on the West Coast but not attending the MySQL User Conference, there are also two *FREE* conferences being held in the same hotel during the same dates. The MySQL Camp 2009 and Percona Performance Conference.

    I will be speaking at both of these conferences on different topics.

  2. Aaron says:

    Thanks Ronald – however I don’t have any budget to attend conferences at this time. :( Good luck with your talks!

  3. Thanks for the list. It has been delicioused.

Leave a Reply

  • twitter loader

Follow me on twitter: @aaronsaray

The views on this website are my own and do not reflect the opinions of my employer or clients.
Creative Commons License Home | Open Source | Book | Music | Art | Bio | Resume | Contact
My Baby