[+/-]
MySQL Enterprise subscription, MySQL Enterprise Monitor, MySQL Replication Monitor, and MySQL Query Analyzer are only available to commercial customers. To learn more, see: http://www.mysql.com/products/enterprise/features.html.
Query Analyzer enables you to monitor the statements being executed on a monitored server and retrieve information about the query, number of executions and the execution times of each query. Queries are normalized, so that the unique data defined within each query has been removed. By removing the data specific elements of the queries, the generic queries can be counted and identified more easily.
MySQL Query Analyzer is designed to gather query performance information from a variety of sources. Query Analyzer uses a new agent plug-in to proxy your queries and collect performance data that is then transmitted to the Enterprise Monitor. This is a new role for the Agent: it is no longer just monitoring, it is now optionally between your MySQL client application and the mysql server.
Depending upon your system load, it is possible to overload the
proxy or have the proxy/agent consume system resources needed by
mysql itself. In particular, the memory needed by the MySQL Agent
for basic monitoring is fairly small and consistent and depends on
the number of rules you have enabled. However, when the Query
Analyzer is enabled, the Agent can use significantly more memory to
monitor and analyze whatever queries you direct through it. In this
case, the amount of memory used depends on the number of unique
normalized queries, example queries and example
EXPLAIN
s being processed plus the network
bandwidth required to send this query performance data to the
Service Manager. In general, the amount of memory used for the Query
Analyzer is well-bounded, but under heavy load or, in some cases
under older versions of linux, RAM usage by Query Analyzer may be
too high for your environment and load.
Therefore we advise you to use this release of Query Analyzer extensively in development, test and stage environments under load for an extended period of time before considering usage in a production environment. For all deployments:
Carefully monitor the Agent's resource consumption using the new graph Memory Usage - Agent graphs available on the Graph tab. You can also add an SMTP or SNMP notification to the new Heat Chart rule MySQL Agent Memory Usage Excessive.
If the amount of memory consumed is too high, consider sampling queries during nonpeak hours or monitoring only a subset of queries on this system.
If you experience any problems with Query Analyzer, we're interested in working with you closely and quickly to resolve them. Please open a Support issue right away. We're already working hard on optimizing Agent/proxy RAM usage and are planning a series of rapid releases to quickly distribute these and other improvements to you.
Query Analyzer works by intercepting the SQL statements that your MySQL client application sends to the MySQL server. Instead of connecting direct to the MySQL Server, queries are routed through the MySQL Enterprise Monitor Agent, the agent/proxy forwards the queries on to the server and sends the replies back to the client application as normal. In addition to forwarding the queries, the agent/proxy will also normalize the queries and then supply the execution information about each query to the monitor. The forwarding functionality is provided by the same module that supports the MySQL Proxy application. For information on MySQL Proxy, see Section 14.6, “MySQL Proxy”.
The MySQL Proxy component, and Query Analyzer, require that clients connecting through MySQL Enterprise Monitor Agent are using MySQL 5.0 or later. Clients that use the library provided with MySQL 4.1 or earlier will not work with MySQL Enterprise Monitor Agent.
Once your MySQL client application has been configured to communicate via the MySQL Enterprise Monitor Agent, queries will be monitored and the simplified queries, without the query specific data, will be sent to the MySQL Enterprise Monitor Agent.
There are a number of different ways that you can enable Query Analysis. For more information on the different options, see Section 15.10.1, “Enabling Query Analyzer”.
To analyse the queries captured by the agent/proxy, change to the
Query Analyzer
page. You can see an example of
the table on that page in the figure below.
The main Query Analyzer table provides the summary information for all of the queries executed via the agent/proxy. The table will track all the queries submitted to the server via the agent/proxy. The table will show a maximum of 20 rows, and you can page through the list of queries by using the page numbers, or the next, previous, first, and last buttons. To filter the list of queries that are displayed, or to change the number of queries, see Section 15.10.4, “Filtering Query Analyzer Data”.
Each row within the table provides the statistical information for one normalized query statement. If you have configured multiple agent/proxies to accept and forward queries to different servers, then you can expand the server view. The summary information displayed is different depending on whether you have selected a server group or an individual server.
If you have selected a server group, then the information displayed is aggregated from across the entire group. The same query executed on multiple servers will show average, total and minimum/maximum information for that query across all the servers. If you select an individual server, then only queries executed on that server are included within the table.
For each row, the following columns are populated according to the selected filtering options. For example, if the filter have been configured to show queries within the last 30 minutes (Interval), then only queries executed during that time will be displayed, and the corresponding statistics, such as execution times, rows returned and bytes returned will be according to that 30 minute timespan.
Query — the normalized version of the query. Normalization removes the query-specific data so that different queries with different data parameters are identified as the same basic query.
The information is shown as one query per row. Each query row is expandable, and can be expanded to show the execution times for individual servers for that query.
Database — the default database in use at the time of the query. The database name may not match the database used within the query if you have have explicitly stated the database name in the query.
Exec Count — the number of times that the query has been executed.
Exec Time — the execution time for all the matching queries. This is the time, for every invocation of the corresponding query, as calculated by comparing the time when the query was submitted and when the results were returned by the server. Times are expressed in HH:MM:SS.MS (hours, minutes, seconds, and milliseconds).
The Execution column is further subdivided into the following columns:
Count — the total number of executions.
Total — the cumulative execution time for all the executions of this query.
Max — the maximum execution time for an execution of this query.
Avg — the average execution time for the execution of this query.
When looking at the information provided in this query, you should consider comparing the average and maximum execution times to see if there was a problem on a specific server or during a specific time period when the query took place, as this may indicate an issue that needs to be investigated. For more information, see Section 15.10.5, “Using Query Analyzer Data”.
Due to limitations in the counters used for monitor queries on Windows, the time reported for short queries may be reported 0.000. This will be fixed in a future release.
Rows — the rows returned by the query. The column is sub-divided into the following columns:
Total — the sum total number of rows returned by all executions of the query.
Max — the maximum number of rows returned by a single execution of the query.
Avg — the average number of rows returned by all executions of the query.
Bytes — the number of bytes returned by each query. The column is sub-divided into the following columns:
Total — the sum total bytes returned by all executions of the query.
Max — the maximum number of bytes returned by a single execution of the query.
Avg — the average number of bytes returned by all executions of the query.
First Seen — the first time the query was seen within the given filter conditions.
You can sort the list of queries by clicking on the column name. The direction of the sort (highest to lowest, or lowest to highest) is indicated by a triangle next to the currently selected column. The default is to sort the list of queries by the Total Execution time.
User Comments
Add your own comment.