radondb / radon

RadonDB is an open source, cloud-native MySQL database for building global, scalable cloud services
https://radondb.io/
GNU General Public License v3.0
1.8k stars 217 forks source link

[feature] complete explain statement #701

Closed hustjieke closed 3 years ago

hustjieke commented 4 years ago

In MySQL 8.0 syntax:

{EXPLAIN | DESCRIBE | DESC}
    tbl_name [col_name | wild]

{EXPLAIN | DESCRIBE | DESC}
    [explain_type]
    {explainable_stmt | FOR CONNECTION connection_id}

{EXPLAIN | DESCRIBE | DESC} ANALYZE [FORMAT = TREE] select_statement

explain_type: {
    FORMAT = format_name
}

format_name: {
    TRADITIONAL
  | JSON
  | TREE
}

explainable_stmt: {
    SELECT statement
  | TABLE statement
  | DELETE statement
  | INSERT statement
  | REPLACE statement
  | UPDATE statement
}

Precautions:

  1. For explain_type in 8.0, extend and partitions are abandoned, for forward compatibility, we'll parse normally.
  2. 8.0 add new feature explain analyze
  3. TABLE statement and REPLACE statement will be supported in the future.

Differently with MySQL, the explain will output radon plan but not MySQL currently.