inspect_mv_plan
inspect_mv_plan(mv_name)
inspect_mv_plan(mv_name, use_cache)
这些函数返回物化视图的逻辑计划。
参数
mv_name
: 物化视图的名称 (VARCHAR)。
use_cache
: (可选) 一个布尔值,指示是否使用物化视图计划缓存。默认为 TRUE
。
返回值
返回包含物化视图逻辑计划的 VARCHAR 字符串。
示例
示例1: 使用计划缓存检查物化视图的逻辑计划:
mysql> select inspect_mv_plan('mv_on_view_1');
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| inspect_mv_plan('mv_on_view_1') |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan 0:
LogicalAggregation {type=GLOBAL ,aggregations={3: sum=sum(2: pv)} ,groupKeys=[1: event_day] ,projection=null ,predicate=null}
-> LogicalOlapScanOperator {table=28673, selectedPartitionId=null, selectedIndexId=28674, outputColumns=[1: event_day, 2: pv], predicate=null, prunedPartitionPredicates=[], limit=-1}
plan 1:
LogicalViewScanOperator {table='view1', outputColumns='[4: event_day, 5: sum_pv]'}
|
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
示例2: 不使用计划缓存检查物化视图的逻辑计划:
mysql> select inspect_mv_plan('mv_on_view_1', false);
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| inspect_mv_plan('mv_on_view_1', FALSE) |
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| plan 0:
LogicalAggregation {type=GLOBAL ,aggregations={3: sum=sum(2: pv)} ,groupKeys=[1: event_day] ,projection=null ,predicate=null}
-> LogicalOlapScanOperator {table=28673, selectedPartitionId=null, selectedIndexId=28674, outputColumns=[1: event_day, 2: pv], predicate=null, prunedPartitionPredicates=[], limit=-1}
plan 1:
LogicalViewScanOperator {table='view1', outputColumns='[4: event_day, 5: sum_pv]'}
|
+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)