Where the open source database community meets: Use code PERCONA75 and secure your spot for Percona Live.  Register

check-unused-keys: A tool to interact with INDEX_STATISTICS

June 26, 2009
Author
Ryan Lowe
Share this Post:

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:

** 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.

0 0 votes
Article Rating
Subscribe
Notify of
guest

10 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Arjen Lentz
16 years ago

into maatkit?

petitchevalroux
16 years ago

Does this script work on a standard Mysql installation (without Google’s user_statistics) ?

Baron Schwartz
16 years ago

I’m pretty sure that is only available with the Percona patches. The Google patches added SHOW commands, we turned them into INFORMATION_SCHEMA tables (I might be wrong about that).

Lance Li
Lance Li
16 years ago

it looks there is a typo

# diff check-unused-keys-0.0.2 check-unused-keys-0.0.2.1
153c153
my @tbls = split(/,/, $OPTIONS{‘tables’});

Lance Li
Lance Li
16 years ago

sorry for the duplicate comment… it looks i cannot paste a diff result here.

but i really think you know what i mean… 🙂

chava
chava
16 years ago

tried to use the below check-ununsed-keys but failed. pls.help

# ./check-unused-keys. -uusername -ppassword -Hhostname -iportname -ddbname

Could not connect to MySQL

i logged in with the same credentials using mysql -uusername -ppassword -hhostname -Pportname

any help will be appreciated

chava
chava
16 years ago

thanks Ryan,

i used perl check-unused-keys. with options and it worked like a charm, we use perl customized to our environment so. i had to use that instead of ./check-unused-keys .

thanks

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved