Archive for the ‘Perl’ Category
innotop version 1.8.0 released
I’ve just uploaded the new release of innotop to Google Code. Short version of the changelog: works on MySQL 5.1 with the InnoDB plugin; more efficient; supports Percona/MariaDB USER_STATISTICS data; fixes a bunch of small annoying bugs.
Longer version:
2010-11-06: version 1.8.0
Changes:
* Don't re-fetch SHOW VARIABLES every iteration; it's too slow on many hosts.
* Add a filter to remove EVENT threads in SHOW PROCESSLIST (issue 32).
* Add a timestamp to output in -n mode, when -t is specified (issue 37).
* Add a new U mode, for Percona/MariaDB USER_STATISTICS (issue 39).
* Add support for millisecond query time in Percona Server (issue 39).
* Display a summary of queries executed in Query List mode (issue 26).
Bugs fixed:
* Made config-file reading more robust (issue 41).
* Hostname parsing wasn't standards compliant (issue 30).
* MKDEBUG didn't work on some Perl versions (issue 22).
* Don't try to get InnoDB status if have_innodb != YES (issue 33).
* Status text from the InnoDB plugin wasn't parsed correctly (issue 36).
* Transaction ID from InnoDB plugin wasn't subtracted correctly (issue 38).
* Switching modes and pressing ? for help caused a crash (issue 40).
New Maatkit tool to compute index usage
In a couple of recent consulting cases, I needed a tool to analyze how a log of queries accesses indexes and tables in the database, specifically, to find out which indexes are not used. I initially hacked together something similar to Daniel Nichter’s mysqlidxchk, but using the framework provided by Maatkit, which gave me a pretty good start right out of the box. This was useful in the very tight time constraints I was under, but was not a complete solution. Alas, I could not use anything like Percona’s enhancements for finding unused indexes.
So, in response to another consultant’s customer request (and sponsorship — thank you!) I spent more time actually writing a real tool in the Maatkit style, with full tests and all the rest of the usual goodies. The resulting tool finds all indexes in a server, EXPLAINs the log of queries against the server, and reports which indexes were never selected by EXPLAIN.
Such a tool invites many interesting questions beyond “which indexes are not used.” Here are a few samples:
- Which queries have several possible execution plans?
- Which indexes are chosen instead of other indexes?
- Which queries have many variations? Only one variation?
- Which indexes are considered as alternates for other indexes?
I plan to add functionality for these kinds of questions in the future. But for right now, there’s a start on this tool in Subversion trunk, under mk-index-usage. I am interested in feedback on it; what doesn’t it handle correctly? What else could it do for you? Please post your questions and suggestions to the Maatkit mailing list, or report an issue on the Maatkit project’s issue tracker.
It’s kind of nice to be writing a single-purpose tool again. Many of the Maatkit tools are extremely complex at this point, some with more than 50 command-line options. This one doesn’t have any options at all, besides the standard ones to connect to a MySQL server.
Maatkit learns how to map-reduce
The May release of Maatkit included a new feature in mk-query-digest. This allows you to process queries in many pieces, write out intermediate results, and then combine the pieces in a separate step. Maybe it’s not exactly map-reduce, but it makes a good headline.
The purpose is to enable query analysis across an arbitrarily large group of servers. Process queries on all of them, ship the results to a central place, and then combine them together. Pre-processing the results has some nice benefits, such as reduced bandwidth requirements, speeding up processing by doing it in parallel, and reducing the workload on the central aggregator. One Percona customer with many MySQL instances is trying this out.
The --save-results option on mk-query-digest saves the digested results to a file, stopping just before the final stages of the query event pipeline. There is a tool in Subversion trunk, tentatively called mk-merge-mqd-results, which reads these saved files, aggregates them together, and then finishes the process of computing statistics and making a report.


