Mysql – the impact of SHOW STATUS, and how often is acceptable to call it

MySQLperformancestatistics

I am setting up a monitoring thread in my application that should use the SHOW STATUS call of mysql to periodically calculate system / db runtime statistics.

Being relatively unfamiliar with datbase backends, my question is

What is the impact of running SHOW STATUS against the database? And how often is acceptable to call it? Would this cause any significant db slow downs?

The rest of my application collects statistics once per minute.

Best Answer

SHOW STATUS has minor impact on the system.

For monitoring, you really need SHOW GLOBAL STATUS so you can get the system-wide counters, not the SESSION counters for the monitor's connection.

It is probably unreasonable to do SHOW GLOBAL STATUS more than once a second. And, at that frequency, it has negligible overhead. Keep in mind that you then have to do something with the hundreds of values. If you turn around and INSERT it into the same server, that action may be more invasive.

Or is this what you are doing to see what is happening with a query?

FLUSH STATUS;
SELECT ...;
SHOW SESSION STATUS LIKE 'Handler%';

Again, do it as needed; don't worry.