数据仓库服务 GAUSSDB(DWS)-EXPLAIN:语法格式

时间:2024-09-24 15:54:40

语法格式

  • 显示SQL语句的执行计划,支持多种选项,对选项顺序无要求:
    1
    EXPLAIN [ (  option  [, ...] )  ] statement;
    

    其中选项option子句的语法为:

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    ANALYZE [ boolean ] |
        ANALYSE [ boolean ] |
        VERBOSE [ boolean ] |
        COSTS [ boolean ] |
        CPU [ boolean ] |
        DETAIL [ boolean ] |
        NODES [ boolean ] |
        NUM_NODES [ boolean ] |
        BUFFERS [ boolean ] |
        TIMING [ boolean ] |
        PLAN [ boolean ] |
        FORMAT { TEXT | XML | JSON | YAML }
    
  • 显示SQL语句的执行计划,且要按顺序给出选项:
    1
    EXPLAIN  { [  { ANALYZE  | ANALYSE  }  ] [ VERBOSE  ]  | PERFORMANCE  } statement;
    
  • 显示复现SQL语句的执行计划所需的信息,通常用于定位问题。STATS选项必须单独使用:
    1
    EXPLAIN ( STATS [ boolean ] ) statement;
    
support.huaweicloud.com/sqlreference-910-dws/dws_06_0232.html