MySQL – Understanding Queries Per Second Average

MySQL

When running the status command in MySQL, one of the metrics that is sent back is "Queries per second avg: 5910.758"

I was wondering if anybody know what makes up that number?

Reason for asking is we tracked all the selects, updates, inserts from the performance_schema and we don't get anywhere near that number.

Best Answer

Tracing it through it ends up being a COM_STATISTICS in the protocol, resulting in this bit of server code.

So based this 'Queries per second avg' is the, the thread_id as the number of queries, divided by the total uptime of the server.