Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count connections differently #3

Merged
merged 4 commits into from Aug 31, 2015
Merged

Conversation

metavida
Copy link

Use the SESSION_STATUS table instead of PROCESSLIST table because:

  1. The INFORMATION_SCHEMA.SESSION_STATUS table allows us to get a total count of the number of "Threads Connected" which is equivalent to the previous SELECT count(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER != 'system user' query.`
  2. The INFORMATION_SCHEMA.SESSION_STATUS table lets us get a count of the number of "Threads Running" which gives a slightly more accurate indication of the amount of load the DB is actually recieving from all of its connections.
  3. Queries to the INFORMATION_SCHEMA.SESSION_STATUS table don't require any additional privilages be granted to the MySQL user running the queries. Granting the PROCESS permissions (as was previously required) allows visibility into the contents of MySQL queries being run by all connected MySQL users.

The `INFORMATION_SCHEMA.SESSION_STATUS` table allows us to get a total count of the number of "Threads Connected" which is equivalent to the previous `SELECT count(*) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER != 'system user'` query.`

Additinally, the `INFORMATION_SCHEMA.SESSION_STATUS` table lets us get a count of the number of "Threads Running" which gives a slightly more accurate indication of the amount of load the DB is actually recieving from all of its connections.

The real benefit, though, is that queries to the `INFORMATION_SCHEMA.SESSION_STATUS` table don't require any additional privilages be granted to the MySQL user running the queries. Granting the `PROCESS` permissions (as was previously required) allows visibility into the contents of MySQL queries being run by all connected MySQL users.
I'm not sure what an underscore does at the beginning of an import line & I'm not going to take the time to look it up right now :-P
metavida added a commit that referenced this pull request Aug 31, 2015
@metavida metavida merged commit a8467e8 into master Aug 31, 2015
@metavida metavida deleted the count_connections_differently branch August 31, 2015 18:22
metavida added a commit that referenced this pull request Aug 31, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant