With the growing adoption of Google’s User Statistics Patch**, the need for supporting scripts has become clear. To that end, we’ve created check-unused-keys, a Perl script to provide a nicer interface than directly querying the INFORMATION_SCHEMA database.
check-unused-keys can be invoked and used as follows:
|
1 |
<br>%> check-unused-keys --help<br>Usage:<br> check-unused-keys [OPTIONS]<br><br> Options:<br> -d, --databases=<dbname> Comma-separated list of databases to check<br> -h, --help Display this message and exit<br> -H, --hostname=<hostname> The target MySQL server host<br> --ignore-databases Comma-separated list of databases to ignore<br> --ignore-indexes Comma-separated list of indexes to ignore<br> db_name.tbl_name.index_name<br> --ignore-tables Comma-separated list of tables to ignore<br> db_name.tbl_name<br> --options-file The options file to use<br> -p, --password=<password> The password of the MySQL user<br> -i, --port=<portnum> The port MySQL is listening on<br> -s, --socket=<sockfile> Use the specified mysql unix socket to connect<br> -t, --tables=<tables> Comma-separated list of tables to evaluate<br> db_name.tbl_name<br> --[no]summary Display summary information<br> -u, --username=<username> The MySQL user used to connect<br> -v, --verbose Increase verbosity level<br> -V, --version Display version information and exit<br><br> Defaults are:<br><br> ATTRIBUTE VALUE<br> -------------------------- ------------------<br> databases ALL databases <br> help FALSE<br> hostname localhost<br> ignore-databases No default value<br> ignore-indexes No default value<br> ignore-tables No default value<br> options-file ~/.my.cnf<br> password No default value<br> port 3306<br> socket No default value<br> summary TRUE<br> tables No Default Value<br> username No default value<br> verbose 0 (out of 2)<br> version FALSE<br> |
** FULLTEXT indexes are not taken into account by this patch, so be wary. And, as always, sanity check the suggestions and test thoroughly before making changes to production.