oak-show-limits

NAME

oak-show-limits: show AUTO_INCREMENT "free space"

SYNOPSIS

Show all AUTO_INCREMENT columns, current AUTO_INCREMENT values and upper bounds, usage ratio, on all schemata and on all tables:
oak-show-limits
As above, for tables in the `world` database only:
oak-show-limits --database=world
As above, on the given table only:
oak-show-limits --database=world --table=City
Only diagnose columns named `id`, on all schemata and all tables:
oak-show-limits --column=id
Only report columns where the current AUTO_INCREMENT value exceeds 10% of upper bound.
oak-show-limits --threshold=0.1
Same as above, provide connection parameters, prompt for password:
oak-show-limits --user=root --ask-pass --socket=/tmp/mysql.sock -l 0.1
Same as above, use defaults file:
oak-show-limits --defaults-file=/home/myuser/.my-oak.cnf -l 0.1

DESCRIPTION

oak-show-limits looks for AUTO_INCREMENT columns, and compares current values with the column type. It reports those columns where the AUTO_INCREMENT value is higher than a given threshold. This utility can be used for diagnosing underestimated and overestimated data type ranges. Underestimated data types are those in which the AUTO_INCRMENET current value is approaching the upper limit. Overestimated data types are those where the current value is extremely far from the upper limit. Output is in tab delimited, where each row specifies:
  • An AUTO_INCREMENT fully qualified column name
  • Current AUTO_INCREMENT value and upper bound
  • Usage ratio (max value/upper bound)

OPTIONS

--ask-pass

Prompt for password.

-c COLUMN_NAME, --column=COLUMN_NAME

AUTO_INCREMENT column name (leave blank for all AUTO_INCREMENT columns)

-d DATABASE_NAME, --database=DATABASE_NAME

Database name (if not specified, all schemata are analyzed)

--defaults-file=DEFAULTS_FILE

Read from MySQL configuration file. Overrides --user, --password, --socket, --port.

Configuration needs to be in the following format:

[client]
user=my_user
password=my_pass
socket=/tmp/mysql.sock
port=3306

-H HOST, --host=HOST

MySQL host (default: localhost)

-l RATIO_THRESHOLD, --threshold=RATIO_THRESHOLD

Only show ratios larger than given threshold in range [0..1)

-p PASSWORD, --password=PASSWORD

MySQL password

-P PORT, --port=PORT

TCP/IP port (default: 3306)

-S SOCKET, --socket=SOCKET

MySQL socket file. Only applies when host is localhost

-t TABLE_NAME, --table=TABLE_NAME

Table name (if not specified, all tables are analyzed)

-u USER, --user=USER

MySQL user

ENVIRONMENT

Requires MySQL 5.0 or newer, python 2.3 or newer. python-mysqldb must be installed in order to use this tool. You can
apt-get install python-mysqldb
or
yum install mysql-python

SEE ALSO

LICENSE

This tool is released under the BSD license.
Copyright (c) 2008 - 2010, Shlomi Noach
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the organization nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

AUTHOR

Shlomi Noach
 
openark kit documentation