Logo
SQL Parser

SQL_Parser #

语法描述类型
ALTER SQL_PARSER RULE更新 SQL 解析规则配置RAL
SHOW SQL_PARSER RULE查询 SQL 解析规则配置RAL

1. 更新 SQL 解析规则配置 #

alterSQLParserRule
    : ALTER SQL_PARSER RULE sqlParserRuleDefinition
    ;

sqlParserRuleDefinition
    : ( (sqlParserTypeDefinition ,)? parseTreeCacheDefinition? (,? sqlStatementCacheDefinition)? )
    ;

sqlParserTypeDefinition
    : SQL_PARSER_TYPE = databaseType
    ;

parseTreeCacheDefinition
    : PARSE_TREE_CACHE ( cacheOption )
    ;

sqlStatementCacheDefinition
    : SQL_STATEMENT_CACHE ( cacheOption )
    ;

cacheOption
    : (INITIAL_CAPACITY = initialCapacity)? (,? MAXIMUM_SIZE = maximumSize)?
    ;

参数说明

  • SQL_PARSER_TYPE SQL 解析类型,默认为空,该参数适用于异构数据库场景以及 Proxy 端接入非 MySQL、PG 协议的数据库
  • PARSE_TREE_CACHE 语法树本地缓存配置
  • SQL_STATEMENT_CACHE SQL 语句本地缓存配置

示例

ALTER SQL_PARSER RULE (
  SQL_PARSER_TYPE=Oracle, 
  PARSE_TREE_CACHE(INITIAL_CAPACITY=128, MAXIMUM_SIZE=1024),
  SQL_STATEMENT_CACHE(INITIAL_CAPACITY=2000, MAXIMUM_SIZE=65535)
);

2. 查询 SQL 解析规则配置 #

SHOW SQL_PARSER RULE

输出说明

说明
sql_parser_typeSQL 解析类型
parse_tree_cache语法树本地缓存配置
sql_statement_cacheSQL 语句本地缓存配置

示例

mysql> SHOW SQL_PARSER RULE;
+-----------------+-----------------------------------------+-------------------------------------------+
| sql_parser_type | parse_tree_cache                        | sql_statement_cache                       |
+-----------------+-----------------------------------------+-------------------------------------------+
| Oracle          | initialCapacity: 128, maximumSize: 1024 | initialCapacity: 2000, maximumSize: 65535 |
+-----------------+-----------------------------------------+-------------------------------------------+
1 row in set (0.01 sec)