NAME
pt-mysql-summary - Summarize MySQL information nicely.
SYNOPSIS
Usage: pt-mysql-summary [OPTIONS]
pt-mysql-summary conveniently summarizes the status and configuration of a MySQL database server so that you can learn about it at a glance. It is not a tuning tool or diagnosis tool. It produces a report that is easy to diff and can be pasted into emails without losing the formatting. It should work well on any modern UNIX systems.
RISKS
Percona Toolkit is mature, proven in the real world, and well tested, but all database tools can pose a risk to the system and the database server. Before using this tool, please:
- •
-
Read the tool's documentation
- •
-
Review the tool's known "BUGS"
- •
-
Test the tool on a non-production server
- •
-
Backup your production server and verify the backups
DESCRIPTION
pt-mysql-summary works by connecting to a MySQL database server and querying it for status and configuration information. It saves these bits of data into files in a temporary directory, and then formats them neatly with awk and other scripting languages.
To use, simply execute it. Optionally add a double dash and then the same command-line options you would use to connect to MySQL, such as the following:
pt-mysql-summary --user=root
The tool interacts minimally with the server upon which it runs. It assumes that you'll run it on the same server you're inspecting, and therefore it assumes that it will be able to find the my.cnf configuration file, for example. However, it should degrade gracefully if this is not the case. Note, however, that its output does not indicate which information comes from the MySQL database and which comes from the host operating system, so it is possible for confusing output to be generated if you run the tool on one server and connect to a MySQL database server running on another server.
OUTPUT
Many of the outputs from this tool are deliberately rounded to show their magnitude but not the exact detail. This is called fuzzy-rounding. The idea is that it does not matter whether a server is running 918 queries per second or 921 queries per second; such a small variation is insignificant, and only makes the output hard to compare to other servers. Fuzzy-rounding rounds in larger increments as the input grows. It begins by rounding to the nearest 5, then the nearest 10, nearest 25, and then repeats by a factor of 10 larger (50, 100, 250), and so on, as the input grows.
The following is a sample of the report that the tool produces:
# Percona Toolkit MySQL Summary Report #######################System time | 2012-03-30 18:46:05 UTC(local TZ: EDT -0400)# Instances ##################################################Port Data Directory Nice OOM Socket===== ========================== ==== === ======12345 /tmp/12345/data 0 0 /tmp/12345.sock12346 /tmp/12346/data 0 0 /tmp/12346.sock12347 /tmp/12347/data 0 0 /tmp/12347.sock
The first two sections show which server the report was generated on and which MySQL instances are running on the server. This is detected from the output of "ps" and does not always detect all instances and parameters, but often works well. From this point forward, the report will be focused on a single MySQL instance, although several instances may appear in the above paragraph.
# Report On Port 12345 #######################################User | msandbox@%Time | 2012-03-30 14:46:05 (EDT)Hostname | localhost.localdomainVersion | 5.5.20-log MySQL Community Server (GPL)Built On | linux2.6 i686Started | 2012-03-28 23:33 (up 1+15:12:09)Databases | 4Datadir | /tmp/12345/data/Processes | 2 connected, 2 runningReplication | Is not a slave, has 1 slaves connectedPidfile | /tmp/12345/data/12345.pid (exists)
This section is a quick summary of the MySQL instance: version, uptime, and other very basic parameters. The Time output is generated from the MySQL server, unlike the system date and time printed earlier, so you can see whether the database and operating system times match.
# Processlist ################################################Command COUNT(*) Working SUM(Time) MAX(Time)------------------------------ -------- ------- --------- ---------Binlog Dump 1 1 150000 150000Query 1 1 0 0User COUNT(*) Working SUM(Time) MAX(Time)------------------------------ -------- ------- --------- ---------msandbox 2 2 150000 150000Host COUNT(*) Working SUM(Time) MAX(Time)------------------------------ -------- ------- --------- ---------localhost 2 2 150000 150000db COUNT(*) Working SUM(Time) MAX(Time)------------------------------ -------- ------- --------- ---------NULL 2 2 150000 150000State COUNT(*) Working SUM(Time) MAX(Time)------------------------------ -------- ------- --------- ---------Master has sent all binlog to 1 1 150000 150000NULL 1 1 0 0
This section is a summary of the output from SHOW PROCESSLIST. Each sub-section is aggregated by a different item, which is shown as the first column heading. When summarized by Command, every row in SHOW PROCESSLIST is included, but otherwise, rows whose Command is Sleep are excluded from the SUM and MAX columns, so they do not skew the numbers too much. In the example shown, the server is idle except for this tool itself, and one connected replica, which is executing Binlog Dump.
The columns are the number of rows included, the number that are not in Sleep status, the sum of the Time column, and the maximum Time column. The numbers are fuzzy-rounded.
# Status Counters (Wait 10 Seconds) ##########################Variable Per day Per second 10 secsBinlog_cache_disk_use 4Binlog_cache_use 80Bytes_received 15000000 175 200Bytes_sent 15000000 175 2000Com_admin_commands 1...................(many lines omitted)............................Threads_created 40 1Uptime 90000 1 1
This section shows selected counters from two snapshots of SHOW GLOBAL STATUS, gathered approximately 10 seconds apart and fuzzy-rounded. It includes only items that are incrementing counters; it does not include absolute numbers such as the Threads_running status variable, which represents a current value, rather than an accumulated number over time.
The first column is the variable name, and the second column is the counter from the first snapshot divided by 86400 (the number of seconds in a day), so you can see the magnitude of the counter's change per day. 86400 fuzzy-rounds to 90000, so the Uptime counter should always be about 90000.
The third column is the value from the first snapshot, divided by Uptime and then fuzzy-rounded, so it represents approximately how quickly the counter is growing per-second over the uptime of the server.
The fourth column is the incremental difference from the first and second snapshot, divided by the difference in uptime and then fuzzy-rounded. Therefore, it shows how quickly the counter is growing per second at the time the report was generated.
# Table cache ################################################Size | 400Usage | 15%
This section shows the size of the table cache, followed by the percentage of the table cache in use. The usage is fuzzy-rounded.
# Key Percona Server features ################################Table & Index Stats | Not SupportedMultiple I/O Threads | EnabledCorruption Resilient | Not SupportedDurable Replication | Not SupportedImport InnoDB Tables | Not SupportedFast Server Restarts | Not SupportedEnhanced Logging | Not SupportedReplica Perf Logging | Not SupportedResponse Time Hist. | Not SupportedSmooth Flushing | Not SupportedHandlerSocket NoSQL | Not SupportedFast Hash UDFs | Unknown
This section shows features that are available in Percona Server and whether they are enabled or not. In the example shown, the server is standard MySQL, not Percona Server, so the features are generally not supported.
# Plugins ####################################################InnoDB compression | ACTIVE
This feature shows specific plugins and whether they are enabled.
# Query cache ################################################query_cache_type | ONSize | 0.0Usage | 0%HitToInsertRatio | 0%
This section shows whether the query cache is enabled and its size, followed by the percentage of the cache in use and the hit-to-insert ratio. The latter two are fuzzy-rounded.
# Schema #####################################################Database Tables Views SPs Trigs Funcs FKs Partnmysql 24performance_schema 17sakila 16 7 3 6 3 22Database MyISAM CSV PERFORMANCE_SCHEMA InnoDBmysql 22 2performance_schema 17sakila 8 15Database BTREE FULLTEXTmysql 31performance_schemasakila 63 1c t s e l d i t m v sh i e n o a n i e a ma m t u n t t n d r ar e m g e y i c ls b t i u h lt l i n m a ia o m t t r nm b e e tp xtDatabase === === === === === === === === === === ===mysql 61 10 6 78 5 4 26 3 4 5 3performance_schema 5 16 33sakila 1 15 1 3 4 3 19 42 26
If you specify "--databases" or "--all-databases", the tool will print the above section. This summarizes the number and type of objects in the databases. It is generated by running "mysqldump --no-data", not by querying the INFORMATION_SCHEMA, which can freeze a busy server.
The first sub-report in the section is the count of objects by type in each database: tables, views, and so on. The second one shows how many tables use various storage engines in each database. The third sub-report shows the number of each type of indexes in each database.
The last section shows the number of columns of various data types in each database. For compact display, the column headers are formatted vertically, so you need to read downwards from the top. In this example, the first column is "char" and the second column is "timestamp". This example is truncated so it does not wrap on a terminal.
All of the numbers in this portion of the output are exact, not fuzzy-rounded.
# Noteworthy Technologies ####################################Full Text Indexing | YesGeospatial Types | NoForeign Keys | YesPartitioning | NoInnoDB Compression | YesSSL | NoExplicit LOCK TABLES | NoDelayed Insert | NoXA Transactions | NoNDB Cluster | NoPrepared Statements | NoPrepared statement count | 0
This section shows some specific technologies used on this server. Some of them are detected from the schema dump performed for the previous sections; others can be detected by looking at SHOW GLOBAL STATUS.
# InnoDB #####################################################Version | 1.1.8Buffer Pool Size | 16.0MBuffer Pool Fill | 100%Buffer Pool Dirty | 0%File Per Table | OFFPage Size | 16kLog File Size | 2 * 5.0M = 10.0MLog Buffer Size | 8MFlush Method |Flush Log At Commit | 1XA Support | ONChecksums | ONDoublewrite | ONR/W I/O Threads | 4 4I/O Capacity | 200Thread Concurrency | 0Concurrency Tickets | 500Commit Concurrency | 0Txn Isolation Level | REPEATABLE-READAdaptive Flushing | ONAdaptive Checkpoint |Checkpoint Age | 0InnoDB Queue | 0 queries inside InnoDB, 0 queries in queueOldest Transaction | 0 SecondsHistory List Len | 209Read Views | 1Undo Log Entries | 1 transactions, 1 total undo, 1 max undoPending I/O Reads | 0 buf pool reads, 0 normal AIO,0 ibuf AIO, 0 preadsPending I/O Writes | 0 buf pool (0 LRU, 0 flush list, 0 page);0 AIO, 0 sync, 0 log IO (0 log, 0 chkp);0 pwritesPending I/O Flushes | 0 buf pool, 0 logTransaction States | 1xnot started
This section shows important configuration variables for the InnoDB storage engine. The buffer pool fill percent and dirty percent are fuzzy-rounded. The last few lines are derived from the output of SHOW INNODB STATUS. It is likely that this output will change in the future to become more useful.
# MyISAM #####################################################Key Cache | 16.0MPct Used | 10%Unflushed | 0%
This section shows the size of the MyISAM key cache, followed by the percentage of the cache in use and percentage unflushed (fuzzy-rounded).
# Security ###################################################Users | 2 users, 0 anon, 0 w/o pw, 0 old pwOld Passwords | OFF
This section is generated from queries to tables in the mysql system database. It shows how many users exist, and various potential security risks such as old-style passwords and users without passwords.
# Binary Logging #############################################Binlogs | 1Zero-Sized | 0Total Size | 21.8Mbinlog_format | STATEMENTexpire_logs_days | 0sync_binlog | 0server_id | 12345binlog_do_db |binlog_ignore_db |
This section shows configuration and status of the binary logs. If there are zero-sized binary logs, then it is possible that the binlog index is out of sync with the binary logs that actually exist on disk.
# Noteworthy Variables #######################################Auto-Inc Incr/Offset | 1/1default_storage_engine | InnoDBflush_time | 0init_connect |init_file |sql_mode |join_buffer_size | 128ksort_buffer_size | 2Mread_buffer_size | 128kread_rnd_buffer_size | 256kbulk_insert_buffer | 0.00max_heap_table_size | 16Mtmp_table_size | 16Mmax_allowed_packet | 1Mthread_stack | 192klog | OFFlog_error | /tmp/12345/data/mysqld.loglog_warnings | 1log_slow_queries | ONlog_queries_not_using_indexes | OFFlog_slave_updates | ON
This section shows several noteworthy server configuration variables that might be important to know about when working with this server.
# Configuration File #########################################Config File | /tmp/12345/my.sandbox.cnf[client]user = msandboxpassword = msandboxport = 12345socket = /tmp/12345/mysql_sandbox12345.sock[mysqld]port = 12345socket = /tmp/12345/mysql_sandbox12345.sockpid-file = /tmp/12345/data/mysql_sandbox12345.pidbasedir = /home/baron/5.5.20datadir = /tmp/12345/datakey_buffer_size = 16Minnodb_buffer_pool_size = 16Minnodb_data_home_dir = /tmp/12345/datainnodb_log_group_home_dir = /tmp/12345/datainnodb_data_file_path = ibdata1:10M:autoextendinnodb_log_file_size = 5Mlog-bin = mysql-binrelay_log = mysql-relay-binlog_slave_updatesserver-id = 12345report-host = 127.0.0.1report-port = 12345log-error = mysqld.loginnodb_lock_wait_timeout = 3# The End ####################################################
This section shows a pretty-printed version of the my.cnf file, with comments removed and with whitespace added to align things for easy reading. The tool tries to detect the my.cnf file by looking at the output of ps, and if it does not find the location of the file there, it tries common locations until it finds a file. Note that this file might not actually correspond with the server from which the report was generated. This can happen when the tool isn't run on the same server it's reporting on, or when detecting the location of the configuration file fails.
OPTIONS
All options after -- are passed to "mysql".
- --all-databases
-
mysqldump and summarize all databases. See "--databases".
- --ask-pass
-
Prompt for a password when connecting to MySQL.
- --config
-
type: string
Read this comma-separated list of config files. If specified, this must be the first option on the command line.
- --databases
-
type: string
mysqldump and summarize this comma-separated list of databases. Specify "--all-databases" instead if you want to dump and summary all databases.
- --defaults-file
-
short form: -F; type: string
Only read mysql options from the given file. You must give an absolute pathname.
- --help
-
Print help and exit.
- --host
-
short form: -h; type: string
Host to connect to.
- --list-encrypted-tables
-
default: false
Include a list of the encrypted tables in all databases. This can cause slowdowns since querying Information Schema tables can be slow.
- --password
-
short form: -p; type: string
Password to use when connecting. If password contains commas they must be escaped with a backslash: "exam\,ple"
- --port
-
short form: -P; type: int
Port number to use for connection.
- --read-samples
-
type: string
Create a report from the files found in this directory.
- --save-samples
-
type: string
Save the data files used to generate the summary in this directory.
- --sleep
-
type: int; default: 10
Seconds to sleep when gathering status counters.
- --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
-
Print tool's version and exit.
ENVIRONMENT
This tool does not use any environment variables.
SYSTEM REQUIREMENTS
This tool requires Bash v3 or newer, Perl 5.8 or newer, and binutils. These are generally already provided by most distributions. On BSD systems, it may require a mounted procfs.
BUGS
For a list of known bugs, see <https://jira.percona.com/projects/PT/issues>.
Please report bugs at <https://jira.percona.com/projects/PT>. Include the following information in your bug report:
- •
-
Complete command-line used to run the tool
- •
-
Tool "--version"
- •
-
MySQL version of all servers involved
- •
-
Output from the tool including STDERR
- •
-
Input files (log/dump/config files, etc.)
If possible, include debugging output by running the tool with "PTDEBUG"; see "ENVIRONMENT".
ATTENTION
Using <PTDEBUG> might expose passwords. When debug is enabled, all command line parameters are shown in the output.
DOWNLOADING
Visit <http://www.percona.com/software/percona-toolkit/> to download the latest release of Percona Toolkit. Or, get the latest release from the command line:
wget percona.com/get/percona-toolkit.tar.gzwget percona.com/get/percona-toolkit.rpmwget percona.com/get/percona-toolkit.deb
You can also get individual tools from the latest release:
wget percona.com/get/TOOL
Replace "TOOL" with the name of any tool.
AUTHORS
Baron Schwartz, Brian Fraser, and Daniel Nichter
ABOUT PERCONA TOOLKIT
This tool is part of Percona Toolkit, a collection of advanced command-line tools for MySQL developed by Percona. Percona Toolkit was forked from two projects in June, 2011: Maatkit and Aspersa. Those projects were created by Baron Schwartz and primarily developed by him and Daniel Nichter. Visit <http://www.percona.com/software/> to learn about other free, open-source software from Percona.
COPYRIGHT, LICENSE, AND WARRANTY
This program is copyright 2011-2026 Percona LLC and/or its affiliates, 2010-2011 Baron Schwartz.
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, version 2 along with this program; if not, see <https://www.gnu.org/licenses/>.
VERSION
pt-mysql-summary 3.7.1-4