tencent cloud

Feedback

Last updated: 2024-08-07 17:21:18

    Description

    Supported engines: Presto and SparkSQL
    Applicable table: Native and external tables
    Purpose: Display logical or physical plan for executing SQL statements.

    Statement

    Presto

    EXPLAIN [ ( option [, ...] ) ] statement
    -- where option can be one of:
    -- FORMAT { TEXT | GRAPHVIZ | JSON }
    -- TYPE { LOGICAL | DISTRIBUTED | VALIDATE | IO }

    SparkSQL

    EXPLAIN [ EXTENDED | CODEGEN | COST | FORMATTED ] statement
    
    EXPLAIN ANALYZE
    EXPLAIN ANALYZE [VERBOSE] statement

    Example

    -- presto
    EXPLAIN (TYPE VALIDATE) SELECT regionkey, count(*) FROM nation GROUP BY 1;
    EXPLAIN (TYPE IO, FORMAT JSON) INSERT INTO test_nation SELECT * FROM nation WHERE regionkey = 2;
    
    -- EXPLAIN ANALYZE
    EXPLAIN ANALYZE SELECT count(*), clerk FROM orders WHERE orderdate > date '1995-01-01' GROUP BY clerk;
    EXPLAIN ANALYZE VERBOSE SELECT count(clerk) OVER() FROM orders WHERE orderdate > date '1995-01-01';
    
    
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support