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

[mysql] improving accuracy for query exec time. Fixes issue #2406. #2463

Merged
merged 1 commit into from
May 6, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions checks.d/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ def _query_exec_time_per_schema(self, db):
# Fetches the avg query execution time per schema and returns the
# value in microseconds

sql_avg_query_run_time = """SELECT schema_name, SUM(count_star) cnt, ROUND(AVG(avg_timer_wait)/1000000) AS avg_us
sql_avg_query_run_time = """SELECT schema_name, ROUND((SUM(sum_timer_wait) / SUM(count_star)) / 1000000) AS avg_us
FROM performance_schema.events_statements_summary_by_digest
WHERE schema_name IS NOT NULL
GROUP BY schema_name"""
Expand All @@ -1204,7 +1204,7 @@ def _query_exec_time_per_schema(self, db):
schema_query_avg_run_time = {}
for row in cursor.fetchall():
schema_name = str(row[0])
avg_us = long(row[2])
avg_us = long(row[1])

# set the tag as the dictionary key
schema_query_avg_run_time["schema:{0}".format(schema_name)] = avg_us
Expand Down