Documentation Home
MySQL 8.3 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 40.8Mb
PDF (A4) - 40.9Mb
Man Pages (TGZ) - 294.0Kb
Man Pages (Zip) - 409.0Kb
Info (Gzip) - 4.0Mb
Info (Zip) - 4.0Mb
Excerpts from this Manual

MySQL 8.3 Reference Manual  /  ...  /  SHOW PARSE_TREE Statement

15.7.7.26 显示解析树语句

SHOW PARSE_TREE select_statement

显示 PARSE_TREE 以 JSON 格式显示输入 SELECT 语句的解析树表示。

Note

该语句仅在调试版本中可用,或者如果 MySQL 服务器是在使用 -DWITH_SHOW_PARSE_TREE 选项构建的。它仅供测试和开发使用,不适用于生产环境。

示例:

mysql> SHOW PARSE_TREE SELECT * FROM t3 WHERE o_id > 2\G
*************************** 1. row ***************************
Show_parse_tree: {
  "text": "SELECT * FROM t3 WHERE o_id > 2",
  "type": "PT_select_stmt",
  "components": [
    {
      "text": "SELECT * FROM t3 WHERE o_id > 2",
      "type": "PT_query_expression",
      "components": [
        {
          "text": "SELECT * FROM t3 WHERE o_id > 2",
          "type": "PT_query_specification",
          "components": [
            {
              "text": "*",
              "type": "PT_select_item_list",
              "components": [
                {
                  "text": "*",
                  "type": "Item_asterisk"
                }
              ]
            },
            {
              "text": "t3",
              "type": "PT_table_factor_table_ident",
              "table_ident": "`t3`"
            },
            {
              "text": "o_id > 2",
              "type": "PTI_where",
              "components": [
                {
                  "text": "o_id > 2",
                  "type": "PTI_comp_op",
                  "operator": ">",
                  "components": [
                    {
                      "text": "o_id",
                      "type": "PTI_simple_ident_ident"
                    },
                    {
                      "text": "2",
                      "type": "Item_int"
                    }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
}
1 row in set (0.01 sec)