メインコンテンツまでスキップ
バージョン: Candidate-4.0

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)