标签归档:mysqlsla

五款常用mysql slow log分析工具的比较

mysql slow log 是用来记录执行时间较长(超过long_query_time秒)的sql的一种日志工具.

启用 slow log
有两种启用方式:
1, 在my.cnf 里 通过 log-slow-queries[=file_name]
2, 在mysqld进程启动时,指定–log-slow-queries[=file_name]选项

需要比较的五款常用工具

mysqldumpslow, mysqlsla, myprofi, mysql-explain-slow-log, mysqllogfilter 继续阅读

mysqlsla

mysqlsla

mysqlsla parses, filters, analyzes and sorts MySQL slow, general, binary and microslow patched logs in order to create a customizable report of the queries and their meta-property values.

Since these reports are customizable, they can be used for human consumption or be fed into other scripts to further analyze the queries. For example, to profile with mk-query-profiler (a script from Baron Schwartz’s Maatkit) every unique SELECT statement using database foo from a slow log:

         mysqlsla -lt slow slow.log -R print-unique -mf "db=foo" -sf "+SELECT" | \
         mk-query-profiler -separate -database foo

In brief, mysqlsla is a liaison allowing other scripts easy access to queries from a MySQL log. For a quick introduction to what mysqlsla is capable of doing, take a glance at the guide.

The mysqlsla Library

» Guide: Covers installation, basic usage, reports, special topics and advancing

» Documentation: Complete list of command line options, limitations, future features and bugs

» Filters: Overview of mysqlsla v2 log filters

» Reports: Creating and customizing mysqlsla v2 standard reports

» Replays: Working with mysqlsla v2 log replays

» User-Defined Logs (UDL): Creating mysqlsla v2 and MySQL::Log::ParseFilter user-defined logs

Download mysqlsla

Current version: mysqlsla-2.03 (Changes)

  • Installer + man page: mysqlsla-2.03.tar.gz
  • Script only: wget http://hackmysql.com/scripts/mysqlsla

v1.x Retired

Looking for mysqlsla v1.7a or 1.8-DEBUG? The v1 branch has been retired and is no longer supported. The older versions can still be accessed at http://hackmysql.com/archive/.

继续阅读