Determine if the mysql index is used in the workplace, so you can safely remove it.

We have some large indexes that we suspect are not used on our Rails site, and would like to drop them to save space and calculate. However, this can be catastrophic if it turns out that they are being used. How can we confirm that they are not in use?

One option is to log all requests for a while and run an “explanation plan” for any of them that use the specified table. But I heard that the “plan of explanation” can sometimes be inaccurate. We would also need to collect requests within a few hours to make sure there are quite a lot of logs to store and process.

If there was a way to temporarily disable the index, we would be ready to do it if we could quickly turn it on if there were problems. But I see no way to do this everywhere; you can only specify an ignore index indication for individual sql statements.

+4
source share
2 answers

Short answer :

With MySQL 5.6 this can be done by using PERFORMANCE_SCHEMAand ps_helper .

ps_helper is a series of views and routines that present data in PERFORMANCE_SCHEMAmore useful ways. The view you are viewing is as follows: http://www.markleith.co.uk/ps_helper/#schema_unused_indexes

More details:

" " Oracle. MySQL , - http://bugs.mysql.com/bug.php?id=70299.

, . ps_helper + unused_indexes: http://www.tocker.ca/2013/09/05/migrating-from-postgresql-to-mysql.html

+2

: , , .

, , . O (1), .

, , . , , , , , .

, , . , , , , .

, , , . , . , , .

, , , , , . , , , . , , , , , .

0

All Articles