Project: StarRocks (App Definition and Development / Database)
File: EXPLAIN.md

displayed_sidebar: "English" Shows the logical or physical execution plans for a query statement. For instructions on how to analyze a query plan, refer to . :::tip This operation does not require privileges. ::: ```SQL EXPLAIN <query> ``` | Parameter | Description | | - | - | | query | The query statement whose execution plan you want to view. | Returns the execution plan of the input query statement. | Return | Description | | -- | | | avgRowSize | The average size of the scanned data rows. | | cardinality | The total number of data rows in the scanned table. | | colocate | Whether the table is in colocate mode. | | numNodes | The number of nodes to scan. | | rollup | The Rollup materialized view that is used. | | preaggregation | The status of preaggregation. | | predicates | Predicates in the query. | ```Plain mysql> EXPLAIN select count(*) from store_sales, household_demographics, time_dim, store where sssoldtimesk = timedim.ttimesk and sshdemosk = householddemographics.hddemo_sk and ssstoresk = sstoresk and timedim.thour = 8 and timedim.tminute >= 30 and householddemographics.hddep_count = 5 and

= 'ese' order by count(*) limit 100; ++ | Explain String | ++ | PLAN FRAGMENT 0 | | OUTPUT EXPRS:<slot 11> | | PARTITION: UNPARTITIONED | | RESULT SINK | | 12:MERGING-EXCHANGE | | limit: 100 | | tuple ids: 5 | | | | PLAN FRAGMENT 1 | | OUTPUT EXPRS: | | PARTITION: RANDOM | | STREAM DATA SINK | | EXCHANGE ID: 12 | | UNPARTITIONED | | | | 8:TOP-N | | | order by: <slot 11> ASC | | | offset: 0 | | | limit: 100 | | | tuple ids: 5 | | | | | 7:AGGREGATE (update finalize) | | | output: count(*) | | | group by: | | | tuple ids: 4 | | | | | 6:HASH JOIN | | | join op: INNER JOIN (BROADCAST) | | | hash predicates: | | | colocate: false, reason: left hash join node can not do colocate | | | equal join conjunct: `ssstoresk` = `sstoresk` | | | tuple ids: 0 2 1 3 | | | | | |-11:EXCHANGE | | | tuple ids: 3 | | | | | 4:HASH JOIN | | | join op: INNER JOIN (BROADCAST) | | | hash predicates: | | | colocate: false, reason: left hash join node can not do colocate | | | equal join conjunct: `sshdemosk`=`householddemographics`.`hddemo_sk`| | | tuple ids: 0 2 1 | | | | | |-10:EXCHANGE | | | tuple ids: 1 | | | | | 2:HASH JOIN | | | join op: INNER JOIN (BROADCAST) | | | hash predicates: | | | colocate: false, reason: table not in same group | | | equal join conjunct: `sssoldtimesk` = `timedim`.`ttimesk` | | | tuple ids: 0 2 | | | | | |-9:EXCHANGE | | | tuple ids: 2 | | | | | 0:OlapScanNode | | TABLE: store_sales | | PREAGGREGATION: OFF. Reason: `sssoldtime_sk` is value column | | partitions=1/1 | | rollup: store_sales | | tabletRatio=0/0 | | tabletList= | | cardinality=-1 | | avgRowSize=0.0 | | numNodes=0 | | tuple ids: 0 | | | | PLAN FRAGMENT 2 | | OUTPUT EXPRS: | | PARTITION: RANDOM | | | | STREAM DATA SINK | | EXCHANGE ID: 11 | | UNPARTITIONED | | | | 5:OlapScanNode | | TABLE: store | | PREAGGREGATION: OFF. Reason: null | | PREDICATES: `store`.`sstorename` = 'ese' | | partitions=1/1 | | rollup: store | | tabletRatio=0/0 | | tabletList= | | cardinality=-1 | | avgRowSize=0.0 | | numNodes=0 | | tuple ids: 3 | | | | PLAN FRAGMENT 3 | | OUTPUT EXPRS: | | PARTITION: RANDOM | | STREAM DATA SINK | | EXCHANGE ID: 10 | | UNPARTITIONED | | | | 3:OlapScanNode | | TABLE: household_demographics | | PREAGGREGATION: OFF. Reason: null | | PREDICATES: `householddemographics`.`hddep_count` = 5 | | partitions=1/1 | | rollup: household_demographics | | tabletRatio=0/0 | | tabletList= | | cardinality=-1 | | avgRowSize=0.0 | | numNodes=0 | | tuple ids: 1 | | | | PLAN FRAGMENT 4 | | OUTPUT EXPRS: | | PARTITION: RANDOM | | STREAM DATA SINK | | EXCHANGE ID: 09 | | UNPARTITIONED | | | | 1:OlapScanNode | | TABLE: time_dim | | PREAGGREGATION: OFF. Reason: null | | PREDICATES: `timedim`.`thour` = 8, `timedim`.`tminute` >= 30 | | partitions=1/1 | | rollup: time_dim | | tabletRatio=0/0 | | tabletList= | | cardinality=-1 | | avgRowSize=0.0 | | numNodes=0 | | tuple ids: 2 | ++ 128 rows in set (0.02 sec) ```