Skip to main content

MV_INFOS

Description​

Table function, generating temporary tables for asynchronous materialized views, which can view information about asynchronous materialized views created in a certain database.

Syntax​

MV_INFOS("database"="<database>")

Required Parameters​

<database>

Specify the cluster database name to be queried

Return Value​

FieldTypeDescription
IdBIGINTMaterialized view ID
NameTEXTMaterialized view name
JobNameTEXTJob name corresponding to the materialized view
StateTEXTState of the materialized view
SchemaChangeDetailTEXTReason for the state change to SchemaChange
RefreshStateTEXTRefresh state of the materialized view
RefreshInfoTEXTRefresh strategy information defined for the materialized view
QuerySqlTEXTSQL query defined for the materialized view
EnvInfoTEXTEnvironment information when the materialized view was created
MvPropertiesTEXTMaterialized view properties
MvPartitionInfoTEXTPartition information of the materialized view
SyncWithBaseTablesBOOLEANWhether the data is synchronized with the base table. To check which partition is not synchronized, use SHOW PARTITIONS

Examples​

View all materialized views under test

select * from mv_infos("database"="test");
+-------+--------------------------+------------------+--------+--------------------+--------------+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+--------------------+
| Id | Name | JobName | State | SchemaChangeDetail | RefreshState | RefreshInfo | QuerySql | MvProperties | MvPartitionInfo | SyncWithBaseTables |
+-------+--------------------------+------------------+--------+--------------------+--------------+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+--------------------+
| 19494 | mv1 | inner_mtmv_19494 | NORMAL | | SUCCESS | BUILD DEFERRED REFRESH AUTO ON MANUAL | SELECT `internal`.`test`.`user`.`k2`, `internal`.`test`.`user`.`k3` FROM `internal`.`test`.`user` | {partition_sync_limit=100, partition_sync_time_unit=YEAR} | MTMVPartitionInfo{partitionType=FOLLOW_BASE_TABLE, relatedTable=user, relatedCol='k2', partitionCol='k2'} | 1 |
| 21788 | test_tablet_type_mtmv_mv | inner_mtmv_21788 | NORMAL | | SUCCESS | BUILD DEFERRED REFRESH AUTO ON MANUAL | SELECT `internal`.`test`.`test_tablet_type_mtmv_table`.`k2`, `internal`.`test`.`test_tablet_type_mtmv_table`.`k3` from `internal`.`test`.`test_tablet_type_mtmv_table` | {} | MTMVPartitionInfo{partitionType=SELF_MANAGE} | 0 |
+-------+--------------------------+------------------+--------+--------------------+--------------+---------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+--------------------+

View the materialized view named mv1 under test

select * from mv_infos("database"="test") where Name = "mv1";
+-------+------+------------------+--------+--------------------+--------------+---------------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+--------------------+
| Id | Name | JobName | State | SchemaChangeDetail | RefreshState | RefreshInfo | QuerySql | MvProperties | MvPartitionInfo | SyncWithBaseTables |
+-------+------+------------------+--------+--------------------+--------------+---------------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+--------------------+
| 19494 | mv1 | inner_mtmv_19494 | NORMAL | | SUCCESS | BUILD DEFERRED REFRESH AUTO ON MANUAL | SELECT `internal`.`test`.`user`.`k2`, `internal`.`test`.`user`.`k3` FROM `internal`.`test`.`user` | {partition_sync_limit=100, partition_sync_time_unit=YEAR} | MTMVPartitionInfo{partitionType=FOLLOW_BASE_TABLE, relatedTable=user, relatedCol='k2', partitionCol='k2'} | 1 |
+-------+------+------------------+--------+--------------------+--------------+---------------------------------------+---------------------------------------------------------------------------------------------+-----------------------------------------------------------+-----------------------------------------------------------------------------------------------------------+--------------------+