9ffcf48cce
[enhancement](Nereids) Support show process time and process steps by explain statement ( #31339 )
...
## Proposed changes
1. show process time when execute `explain plan xxx` by nereids
2. add `explain xxx plan process select ...` statement to show the process of the plan, not support show memo shape (physical plan) currently
example:
show process time:
```
mysql> explain plan select * from tt;
+---------------------------------------------------------------------------------------------------------------+
| Explain String(Nereids Planner) |
+---------------------------------------------------------------------------------------------------------------+
| ========== PARSED PLAN (time: 3ms) ========== |
| UnboundResultSink[3] ( ) |
| +--LogicalProject[2] ( distinct=false, projects=[*], excepts=[] ) |
| +--LogicalCheckPolicy ( ) |
| +--UnboundRelation ( id=RelationId#0, nameParts=tt ) |
| |
| ========== ANALYZED PLAN (time: 6ms) ========== |
| LogicalResultSink[11] ( outputExprs=[id#0, name#1] ) |
| +--LogicalProject[9] ( distinct=false, projects=[id#0, name#1], excepts=[] ) |
| +--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON ) |
| |
| ========== REWRITTEN PLAN (time: 0ms)========== |
| LogicalResultSink[11] ( outputExprs=[id#0, name#1] ) |
| +--LogicalProject[9] ( distinct=false, projects=[id#0, name#1], excepts=[] ) |
| +--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON ) |
| |
| ========== OPTIMIZED PLAN (time: 2ms) ========== |
| PhysicalResultSink[56] ( outputExprs=[id#0, name#1] ) |
| +--PhysicalDistribute[53]@1 ( stats=2, distributionSpec=DistributionSpecGather ) |
| +--PhysicalProject[50]@1 ( stats=2, projects=[id#0, name#1] ) |
| +--PhysicalOlapScan[tt]@0 ( stats=2 ) |
+---------------------------------------------------------------------------------------------------------------+
21 rows in set (0.01 sec)
```
explain plan process:
```
mysql> explain plan process select * from tt\G
*************************** 1. row ***************************
Rule: BINDING_RELATION
Before: UnboundResultSink[8] ( )
+--LogicalProject[7] ( distinct=false, projects=[*], excepts=[] )
+--LogicalCheckPolicy ( )
+--UnboundRelation ( id=RelationId#0, nameParts=tt )
After: UnboundResultSink[11] ( )
+--LogicalProject[10] ( distinct=false, projects=[*], excepts=[] )
+--LogicalCheckPolicy ( )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
*************************** 2. row ***************************
Rule: CHECK_ROW_POLICY
Before: UnboundResultSink[15] ( )
+--LogicalProject[14] ( distinct=false, projects=[*], excepts=[] )
+--LogicalCheckPolicy ( )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
After: UnboundResultSink[17] ( )
+--LogicalProject[16] ( distinct=false, projects=[*], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
*************************** 3. row ***************************
Rule: BINDING_PROJECT_SLOT
Before: UnboundResultSink[22] ( )
+--LogicalProject[21] ( distinct=false, projects=[*], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
After: UnboundResultSink[23] ( )
+--LogicalProject[20] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
*************************** 4. row ***************************
Rule: BINDING_RESULT_SINK
Before: UnboundResultSink[26] ( )
+--LogicalProject[20] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
After: LogicalResultSink[25] ( outputExprs=[id#0, name#1] )
+--LogicalProject[20] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
*************************** 5. row ***************************
Rule: ELIMINATE_UNNECESSARY_PROJECT
Before: LogicalResultSink[25] ( outputExprs=[id#0, name#1] )
+--LogicalProject[20] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
After: LogicalResultSink[27] ( outputExprs=[id#0, name#1] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
*************************** 6. row ***************************
Rule: PRUNE_EMPTY_PARTITION
Before: LogicalResultSink[29] ( outputExprs=[id#0, name#1] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
After: LogicalResultSink[30] ( outputExprs=[id#0, name#1] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
*************************** 7. row ***************************
Rule: MATERIALIZED_INDEX_SCAN
Before: LogicalResultSink[36] ( outputExprs=[id#0, name#1] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
After: LogicalResultSink[37] ( outputExprs=[id#0, name#1] )
+--LogicalProject[35] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalProject[34] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=tt, selectedIndexId=10361, preAgg=ON )
*************************** 8. row ***************************
Rule: MERGE_PROJECTS
Before: LogicalResultSink[40] ( outputExprs=[id#0, name#1] )
+--LogicalProject[39] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalProject[34] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=tt, selectedIndexId=10361, preAgg=ON )
After: LogicalResultSink[41] ( outputExprs=[id#0, name#1] )
+--LogicalProject[38] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=tt, selectedIndexId=10361, preAgg=ON )
*************************** 9. row ***************************
Rule: ELIMINATE_UNNECESSARY_PROJECT
Before: LogicalResultSink[42] ( outputExprs=[id#0, name#1] )
+--LogicalProject[38] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=tt, selectedIndexId=10361, preAgg=ON )
After: LogicalResultSink[43] ( outputExprs=[id#0, name#1] )
+--LogicalOlapScan ( qualified=test.tt, indexName=tt, selectedIndexId=10361, preAgg=ON )
*************************** 10. row ***************************
Rule: REWRITE_CTE_CHILDREN
Before: LogicalResultSink[25] ( outputExprs=[id#0, name#1] )
+--LogicalProject[20] ( distinct=false, projects=[id#0, name#1], excepts=[] )
+--LogicalOlapScan ( qualified=test.tt, indexName=<index_not_selected>, selectedIndexId=10361, preAgg=ON )
After: LogicalResultSink[43] ( outputExprs=[id#0, name#1] )
+--LogicalOlapScan ( qualified=test.tt, indexName=tt, selectedIndexId=10361, preAgg=ON )
10 rows in set (0.00 sec)
```
2024-02-28 13:07:25 +08:00