mk-merge-mqd-results.1p - Man Page

Merge multiple mk-query-digest reports into one.

Synopsis

Usage: mk-merge-mqd-results [OPTION...] [FILE]

mk-merge-mqd-results parses and analyzes MySQL log files.  With no FILE, or when FILE is -, read standard input.

Examples:

  mk-query-digest slow.log-1 --save-results res1.txt

  mk-query-digest slow.log-2 --save-results res2.txt

  mk-merge-mqd-results res1.txt res2.txt

Risks

The following section is included to inform users about the potential risks, whether known or unknown, of using this tool.  The two main categories of risks are those created by the nature of the tool (e.g. read-only tools vs. read-write tools) and those created by bugs.

At the time of this release, we know of no bugs that could cause serious harm to users.

The authoritative source for updated information is always the online issue tracking system.  Issues that affect this tool will be marked as such.  You can see a list of such issues at the following URL: <http://www.maatkit.org/bugs/mk-merge-mqd-results>.

See also "Bugs" for more information on filing bugs and getting help.

Description

This is a light-weight script for merging and reporting on results saved by mk-query-digest --save-results.

Options

This tool accepts additional command-line arguments.  Refer to the "Synopsis" and usage information for details.

--ask-pass

Prompt for a password when connecting to MySQL.

--charset

short form: -A; type: string

Default character set.  If the value is utf8, sets Perl's binmode on STDOUT to utf8, passes the mysql_enable_utf8 option to DBD::mysql, and runs SET NAMES UTF8 after connecting to MySQL.  Any other value sets binmode on STDOUT without the utf8 layer, and runs SET NAMES after connecting to MySQL.

--config

type: Array

Read this comma-separated list of config files; if specified, this must be the first option on the command line.

--defaults-file

short form: -F; type: string

Only read mysql options from the given file.  You must give an absolute pathname.

--expected-range

type: array; default: 5,10

Explain items when there are more or fewer than expected.

Defines the number of items expected to be seen in the report as controlled by "--limit" and "--outliers".  If there  are more or fewer items in the report, each one will explain why it was included.

--explain

type: DSN

Run EXPLAIN for the sample query with this DSN and print results.

This causes mk-merge-mqd-results to run EXPLAIN and include the output into the report.  For safety, queries that appear to have a subquery that EXPLAIN will execute won't be EXPLAINed.  Those are typically "derived table" queries of the form

  select ... from ( select .... ) der;
--fingerprints

Add query fingerprints to the standard query analysis report.  This is mostly useful for debugging purposes.

--[no]for-explain

default: yes

Print extra information to make analysis easy.

This option adds code snippets to make it easy to run SHOW CREATE TABLE and SHOW TABLE STATUS for the query's tables.  It also rewrites non-SELECT queries into a SELECT that might be helpful for determining the non-SELECT statement's index usage.

--help

Show help and exit.

--host

short form: -h; type: string

Connect to host.

--limit

type: string; default: 95%:20

Limit output to the given percentage or count.

If the argument is an integer, report only the top N worst queries.  If the argument is an integer followed by the % sign, report that percentage of the worst queries.  If the percentage is followed by a colon and another integer, report the top percentage or the number specified by that integer, whichever comes first.

See also "--outliers".

--order-by

type: string; default: Query_time:sum

Sort events by this attribute and aggregate function.

--outliers

type: string; default: Query_time:1:10

Report outliers by attribute:percentile:count.

The syntax of this option is a comma-separated list of colon-delimited strings. The first field is the attribute by which an outlier is defined.  The second is a number that is compared to the attribute's 95th percentile.  The third is optional, and is compared to the attribute's cnt aggregate.  Queries that pass this specification are added to the report, regardless of any limits you specified in "--limit".

For example, to report queries whose 95th percentile Query_time is at least 60 seconds and which are seen at least 5 times, use the following argument:

  --outliers Query_time:60:5
--password

short form: -p; type: string

Password to use when connecting.

--port

short form: -P; type: int

Port number to use for connection.

--report-format

type: Array; default: rusage,date,files,header,profile,query_report,prepared

Print these sections of the query analysis report.

  SECTION      PRINTS
  ============ ==============================================================
  rusgae       CPU times and memory usage reported by ps
  date         Current local date and time
  files        Input files read/parse
  header       Summary of the entire analysis run
  profile      Compact table of queries for an at-a-glance view of the report
  query_report Detailed information about each unique query
  prepared     Prepared statements

The sections are printed in the order specified.  The rusage, date, files and header sections are grouped together if specified together; other sections are separted by blank lines.

--report-histogram

type: string; default: Query_time

Chart the distribution of this attribute's values.

The distribution chart is limited to time-based attributes, so charting Rows_examined, for example, will produce a useless chart.

--set-vars

type: string; default: wait_timeout=10000

Set these MySQL variables.  Immediately after connecting to MySQL, this string will be appended to SET and executed.

--shorten

type: int; default: 1024

Shorten long statements in reports.

Shortens long statements, replacing the omitted portion with a /*... omitted ...*/ comment.  This applies only to the output in reports, not to information stored other places.  It prevents a large statement from causing difficulty in a report.  The argument is the preferred length of the shortened statement.  Not all statements can be shortened, but very large INSERT and similar statements often can; and so can IN() lists, although only the first such list in the statement will be shortened.

If it shortens something beyond recognition, you can find the original statement in the log, at the offset shown in the report header.

--show-all

type: Hash

Show all values for these attributes.

By default mk-query-digest only shows as many of an attribute's value that fit on a single line.  This option allows you to specify attributes for which all values will be shown (line width is ignored).  This only works for attributes with string values like user, host, db, etc.  Multiple attributes can be specified, comma-separated.

--socket

short form: -S; type: string

Socket file to use for connection.

--user

short form: -u; type: string

User for login if not current user.

--version

Show version and exit.

--[no]zero-bool

default: yes

Print 0% boolean values in report.

DSN Options

These DSN options are used to create a DSN.  Each option is given like option=value.  The options are case-sensitive, so P and p are not the same option.  There cannot be whitespace before or after the = and if the value contains whitespace it must be quoted.  DSN options are comma-separated.  See the maatkit manpage for full details.

Downloading

You can download Maatkit from Google Code at <http://code.google.com/p/maatkit/>, or you can get any of the tools easily with a command like the following:

   wget http://www.maatkit.org/get/toolname
   or
   wget http://www.maatkit.org/trunk/toolname

Where toolname can be replaced with the name (or fragment of a name) of any of the Maatkit tools.  Once downloaded, they're ready to run; no installation is needed.  The first URL gets the latest released version of the tool, and the second gets the latest trunk code from Subversion.

Environment

The environment variable MKDEBUG enables verbose debugging output in all of the Maatkit tools:

   MKDEBUG=1 mk-....

System Requirements

You need Perl and some core packages that ought to be installed in any reasonably new version of Perl.

Bugs

For a list of known bugs see <http://www.maatkit.org/bugs/mk-merge-mqd-results>.

Please use Google Code Issues and Groups to report bugs or request support: <http://code.google.com/p/maatkit/>.  You can also join #maatkit on Freenode to discuss Maatkit.

Please include the complete command-line used to reproduce the problem you are seeing, the version of all MySQL servers involved, the complete output of the tool when run with "--version", and if possible, debugging output produced by running with the MKDEBUG=1 environment variable.

Copyright, License and Warranty

This program is copyright 2010 Percona Inc. Feedback and improvements are welcome.

THIS PROGRAM IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2; OR the Perl Artistic License.  On UNIX and similar systems, you can issue `man perlgpl' or `man perlartistic' to read these licenses.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.

Author

Daniel Nichter

Version

This manual page documents Ver 0.9.29 Distrib 7540 $Revision: 7477 $.

Info

2024-01-25 perl v5.38.2 User Contributed Perl Documentation