The official way to calculate the key buffer usage as documented in the MySQL Reference manual:
This will return the factor, so you have to multiply it with 100 to get the percentage. The Key_blocks_unused is used instead of the more obvious Key_blocks_used. This is due to the fact that Key_blocks_used is the maximum number of key blocks ever used. It will not return to 0 after a FLUSH TABLES.1 - ((Key_blocks_unused * key_cache_block_size) / key_buffer_size)
This calculation does not take the overhead in account. The key buffer efficiency can be calculated if the [Read more...]