Discussions

Expand all | Collapse all

Can I see a query tree or Explain plan??

Jump to Best Answer
  • 1.  Can I see a query tree or Explain plan??

    Posted 18 days ago
    I ran the query using EXPLAIN, but I didn't get the desired result.
    This result is like an MIPS code.



    The figure below shows the results of the Query Plan of Postgres.
    Can I extract these results from MapD?


    #Core

    ------------------------------
    Jeon Woohyuck
    [[Unknown]]
    ------------------------------


  • 2.  RE: Can I see a query tree or Explain plan??
    Best Answer

    Posted 18 days ago
    Edited by Candido Dessanti 18 days ago
    Hi @Jeon Woohyuck,

    To get a more readable, but less informative, explain plan you have to ask for the Calcite's one

    explain calcite SELECT l_returnflag, l_linestatus,sum(l_quantity) AS sum_qty, sum(l_extendedprice) AS sum_base_price, sum(l_extendedprice*(1-l_discount)) AS sum_disc_price, sum(l_extendedprice*(1-l_discount)*(1+l_tax)) AS sum_charge, avg(l_quantity) AS avg_qty, avg(l_extendedprice) AS avg_price, avg(l_discount) AS avg_disc, count(*) AS count_order FROM lineitem WHERE l_shipdate <= DATE '1996-12-01' - INTERVAL '90' DAY (3) GROUP BY l_returnflag, l_linestatus ORDER BY l_returnflag;

    Explanation
    LogicalSort(sort0=[$0], dir0=[ASC])
       LogicalAggregate(group=[{0, 1}], sum_qty=[SUM($2)], sum_base_price=[SUM($3)], sum_disc_price=[SUM($4)], sum_charge=[SUM($5)], avg_qty=[AVG($2)], avg_price=[AVG($3)], avg_disc=[AVG($6)], count_order=[COUNT()])
         LogicalProject(l_returnflag=[$8], l_linestatus=[$9], L_QUANTITY=[$4], L_EXTENDEDPRICE=[$5], $f4=[*($5, -(1, $6))], $f5=[*(*($5, -(1, $6)), +(1, $7))], L_DISCOUNT=[$6])
           LogicalFilter(condition=[<=($10, -(1996-12-01, 7776000000))])
             EnumerableTableScan(table=[[tpch, lineitem]])


    ------------------------------
    Candido Dessanti
    Dba
    consulting
    Rome
    ------------------------------