12 Apr, 2010  |  Written by shainmiley  |  under Linux, Maatkit, Mysql

One of the tools that is included with Maatkit is called ‘mk-query-digest’.  If you have Mysql slow logging enabled, this perl script can me used to examine these entries, and provide a very useful and user friendly report that will help you understand the queries that are exceeding your current slow log threshold. You can then take the results and determine whether or not you have opportunity to do some schema and/or query optimization.

In order to get the ball rolling all you need to do is execute the following command:

‘perl /path/to/mk-query-digest /path/to/slow.log’

Once you do you will be presented with a report similar to the following:

# 200ms user time, 10ms system time, 9.59M rss, 11.17M vsz
# Overall: 199 total, 8 unique, 0.92 QPS, 3.44x concurrency ______________
#                    total     min     max     avg     95%  stddev  median
# Exec time           745s      1s     15s      4s      9s      3s      3s
# Lock time            4ms       0   159us    21us    66us    18us    16us
# Rows sent         16.35M       0 381.59k  84.16k 298.06k  81.83k  76.03k
# Rows exam         16.35M       0 381.59k  84.16k 298.06k  81.83k  76.03k
# Time range        2010-03-04 18:32:44 to 2010-03-04 18:36:21
# bytes             55.53k       6   7.67k  285.75  313.99  519.23  271.23

Continue Reading ->

22 Feb, 2010  |  Written by shainmiley  |  under Linux, Maatkit, Mysql

Maatkit is a group of perl scripts that provide advanced methods of administration for Mysql.

Here are a few of the more useful things that Maatkit allows you do to:

  1. Monitor MySQL replication delay
  2. Make a MySQL slave server lag behind its master.
  3. Ensuring slaves have the same data as masters
  4. Find duplicate indexes and foreign keys on MySQL tables.
  5. Execute SQL statements and print statistics.
  6. Execute queries on multiple servers and check for differences.

Here is the link to the Maatkit website which provides more details on each of the scripts.  I will be providing some real world examples of Maatkit usage in another post.