31.5 查询分析器配置视图

配置视图使您能够自定义查询分析器视图 上显示 的数据。

图 31.7 配置视图

查询分析器配置视图示例。

图形视图选择器

使您能够选择在查询分析器视图上显示的图以及所选图的时间范围。

要为图表选择时间范围,请从“ 缩放”部分选择一个值。可能的值范围从一小时到两天。

要选择一个或多个图显示在查询分析器视图上,请单击图选择框并从可用选项中选择所需的图。

图 31.8 图形视图

查询分析器图形配置视图的示例。

筛选视图

图 31.9 过滤器视图

查询分析器过滤器配置视图示例。

以下是可能的过滤器选项:

  • Column:使您能够根据查询分析器报告列表中显示的任何列中的特定值过滤查询。

    要使用列过滤器,您必须指定 要过滤 的、执行比较时要使用的运算符以及要比较的

    例如,要筛选平均返回超过 100 行的所有查询,请将Column设置为 Average Rows,将 Operator设置为>=,并将Value设置为 100。

  • 数据库:将查询限制为在特定数据库中执行的查询。数据库匹配是使用LIKEMySQL 数据库中的匹配项执行的,因此您可以使用%_字符来匹配多个和单个字符。有关详细信息,请参阅 模式匹配

  • Notices:过滤通知,使您能够过滤列表以仅显示未发出通知、指示全表扫描或指示使用了错误索引的查询。

  • 语句文本支持规范化查询的文本搜索。对于搜索类型,您可以指定基本文本匹配 ( Contains ) 或正则表达式匹配 ( Regex )。除了基本的文本匹配之外,您还可以搜索不包含特定字符串的查询。对于正则表达式搜索,您可以指定正则表达式是否应匹配或不匹配(负正则表达式)查询。REGEXP()使用标准的 MySQL函数解析正则表达式。有关详细信息,请参阅正则表达式

    笔记

    搜索是针对查询的规范版本执行的。您不能在查询本身的参数中搜索特定文本或值。

  • 语句类型:将搜索限制为特定类型(SELECTLITERAL等)的语句。

  • 时间从/到:使您能够选择过滤的时间范围 。仅显示在显示时间段内执行的查询,使用“ 小时分钟” 弹出窗口,或者选择是否应基于时间段(从/到)。

    使用此属性,您可以仅显示在特定时间范围内执行的查询,并且可以显示更长时间段内的查询历史记录,只要您一直在记录查询分析信息即可。

    笔记

    不可能同时使用时间间隔时间从\到 。您必须使用其中之一。

  • 时间间隔:从图表更新点开始过滤给定时间段内的查询。例如,如果您选择 30 分钟,则显示的查询是最近 30 分钟内捕获的查询。如果您在 14:00 更新显示,则显示的查询是在 13:30 和 14:00 之间捕获的查询。可能的值介于 15 分钟和 2 年之间。

    笔记

    不可能同时使用时间间隔时间从\到 。您必须使用其中之一。

  • View:确定信息是否应该以 Group为基础返回,其中显示在所有受监视服务器上执行的相同查询的聚合,或者以Server为基础,其中查询由单个服务器汇总。如果选择后一个选项,则可以展开语句以列出执行它们的各个服务器。

排序视图

Sort 视图使您能够指定数据在 Statements 视图中的排序方式。

图 31.10 排序视图

查询分析器排序配置视图示例。

  • 数据库:查询时使用的默认数据库。数据库名称可能为空,或者可能与查询中使用的数据库不匹配,如果您使用了限定的表名(例如, select ... from db_name.table_name)或者如果您在连接后发出了USE切换数据库的语句。

  • 错误:突出显示运行查询时遇到的任何特定问题,包括过度的表扫描和错误的索引使用。这些提供了可能需要额外检查的查询问题的即时指示。

  • 执行计数:查询已执行的次数。

  • First Seen:首次看到此查询的规范化版本的日期和时间,可能早于过滤器指定的时间段。

  • 实例:MySQL 实例的名称。

  • Latency:所有匹配查询的执行时间。这是每次调用相应查询的时间,通过比较提交查询的时间和服务器返回结果的时间计算得出。时间以 HH:MM:SS.MS(小时、分钟、秒和毫秒)表示。

    延迟分为以下几组:

    • Latency Total:此查询的所有执行的累计执行时间。

    • Latency Maximum:执行此查询的最长执行时间。

    • Latency Average:执行此查询的平均执行时间。

    • Locks:等待由查询引起的表锁所花费的时间。

    • 平均历史图(Avg History):绘制平均执行时间图。

  • 没有使用好的索引

  • 没有使用索引

  • Rows: The rows returned by the query. This is sub-divided into the following groupings:

    • Rows Total: The sum total number of rows returned by all executions of the query.

    • Rows Average: The average number of rows returned by all executions of the query.

    • Rows Examined: The average number of rows returned by all executions of the query.

  • Select Type

    • Select Type Full Join: number of joins performing table scans because they do not use indexes.

    • Select Type Full Range Join: the number of joins using a range search on a reference table.

    • 选择类型范围:使用第一个表上的范围的联接数。

    • Select Type Range Check:没有键的连接数,在每行之后检查键的使用情况。

    • Select Type Scan:对第一个表执行完整扫描的连接数。

  • 排序

    • 排序合并遍数:排序算法执行的合并遍数。

    • 排序范围:使用范围执行的排序数。

    • 排序行:排序的行数。

    • Sorting Scan: the number of sorts performed by scanning the table.

  • Statement: 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.

    Note

    If the selected context is a cluster, the queries for the cluster's SQL nodes are displayed either for the specific node or for the cluster as an aggregate. If other node types are selected, the aggregate is displayed.

  • Temporary Tables

    • Temporary Tables Average: the average number of internal temporary tables created per occurrence of the statement.

    • Temporary Tables Disk: the total number of internal, on-disk temporary tables created by occurrences of the statement.

    • Temporary Tables Disk % : the percentage of internal in-memory temporary tables that were converted to on-disk tables.

    • Temporary Tables Total: the total number of internal in-memory temporary tables created by occurrences of the statement

  • Time: the time at which the statements were executed.

  • Warnings: the number of warnings generated by a statement.

Data View

The Data View configures the elements displayed in the entries of the Statement view.

Figure 31.11 Data View

查询分析器数据配置视图示例。

The possible properties are as follows:

  • Database: the name of the database on which the statement was executed.

  • Execution Counts: the number of times the statement was executed.

  • First Seen: the time and date the statement was first seen.

  • Information Icons: select which information icons you want displayed on the statement view. These icons are displayed on the right-hand side of the statement. Possible choices are: Notices. Errors, or Warnings.

  • Instance Name: the name of the MySQL instance.

  • Latency: the execution times for the statements. The following latency settings are possible:

    • History Graph: adds a latency graph to the statement data. This graphs the latency high, low, and average history.

    • Total Time: the total time taken by all executions of this statement.

    • Maximum Time: the maximum time taken for an execution of this statement.

    • Average Time: the average execution time for this statement.

    • Lock Time: the time spent waiting for table locks caused by this statement.

  • QRTi Graph: adds a Query Response Time index pie-chart to the left side of the statement. The pie-chart graphs the Optimal, Acceptable, and Unacceptable percentages for the statement.

  • Rows: the number of rows returned. The following are the possible values:

    • Total: the sum total of rows returned by executions of this statement.

    • Examined: the total number of rows read by this statement.

    • Average: the average number of rows returned by this statement.

  • Select Type: the following are the possible values:

    • Full Join: the number of joins performing table scans because they do not use indexes.

    • Full Range: the number of joins using a range search on a reference table.

    • Range: the number of joins using ranges on the first table.

    • Range Check: the number of joins without keys that check for key usage after each row.

    • Scan: the number of joins performing a full scan of the first table.

  • Sorting: the following are the possible values:

    • Merge Passes: the number of merge passes the sort algorithm has performed.

    • Range: the number of sorts performed using ranges.

    • Rows: the number of sorted rows.

    • Scan: the number of sorts performed by scanning the table.

  • Temporary Tables: the following values are possible:

    • Average: the average number of internal temporary tables created per occurrence of the statement.

    • Disk: the total number of internal, on-disk temporary tables created by occurrences of the statement.

    • Disk % : the percentage of internal in-memory temporary tables that were converted to on-disk tables.

    • Total: the total number of internal in-memory temporary tables created by occurrences of the statement

Customizing Filters

Filters can be created, or existing filters customized, in the Query Analyzer Configuration View.

To create a user filter, you can either create a filter and save it by clicking Save as... menu item, or create a new filter by clicking New, defining your filter criteria, and clicking Save as....

You can also create a filter by using an existing filter as a template. Select the filter and make your changes. If you create a named filter based on an existing filter, the -clone is appended to the name when you edit the new filter. The name can be edited as required.

System filters are listed with a padlock on the left side of their name. These cannot be edited, but can be used as templates for new filters.

要将过滤器设置为默认值,请在下拉列表中选择它,然后从相邻的下拉菜单中选择设置为默认值。默认过滤器旁边会显示一个星号。

笔记

如果您从以前的版本升级,并在该版本中使用默认过滤器,您的过滤器将被迁移和重命名 User Default