The two status variables Queries and Questions can sometimes
cause confusion. On the face of it, both appear to count the
number of times a query is executed on the server.
Each variable has both session and global scope, meaning that you
can get statistics for both the current connection and for all
connections. You can reset the session variables by executing
FLUSH STATUS, but resetting the global variables requires a
server restart.
All good so far. However, the way in which these variables are
incremented is not always intuitive.
For one thing, everything in MySQL is a Question. Any
operation you perform, including checking the status of a server
variable is a Question. Even checking the number of Questions
issued by your session is, in itself, a Question:
mysql> SHOW STATUS LIKE 'Questions'; +---------------+-------+
| Variable_name | Value | +---------------+-------+ | Questions |
2 | …
[Read more]