文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 10 优化 / 10.15 跟踪优化器 / 10.15.13 在其他应用程序中显示跟踪
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

10.15.13 在其他应用程序中显示追踪10.15.13 Displaying Traces in Other Applications

在 mysql 命令行客户端中检查追踪可以通过 pager less 命令(或你所在操作平台的等效命令)来简化。另一种方法是将追踪发送到文件,就像这里展示的那样:Examining a trace in the mysql command-line client can be made less difficult using the pager less command (or your operating platform's equivalent). An alternative can be to send the trace to a file, similarly to what is shown here:

SELECT TRACE INTO DUMPFILE file
FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;

然后,你可以将此文件传递给支持 JSON 的文本编辑器或其他查看器,例如 适用于 Firefox 和 Chrome 的 JsonView 插件,它可以彩色显示对象,并允许展开或折叠对象。You can then pass this file to a JSON-aware text editor or other viewer, such as the JsonView add-on for Firefox and Chrome, which shows objects in color and allows objects to be expanded or collapsed.

INTO DUMPFILE 比 INTO OUTFILE 更适合此用途,因为后者会转义换行符。如前所述,执行 end_markers_in_json 语句时,应确保 OFF 为 SELECT INTO,以确保输出是有效的 JSON。INTO DUMPFILE is preferable to INTO OUTFILE for this purpose, since the latter escapes newlines. As noted previously, you should ensure that end_markers_in_json is OFFwhen executing the SELECT INTO statement, so that the output is valid JSON.