mv_infos

Name

mv_infos

description

表函数,生成异步物化视图临时表,可以查看某个db中创建的异步物化视图信息。

该函数用于 from 子句中。

syntax

mv_infos("database"="")

mv_infos()表结构:

  1. mysql> desc function mv_infos("database"="tpch100");
  2. +--------------------+---------+------+-------+---------+-------+
  3. | Field | Type | Null | Key | Default | Extra |
  4. +--------------------+---------+------+-------+---------+-------+
  5. | Id | BIGINT | No | false | NULL | NONE |
  6. | Name | TEXT | No | false | NULL | NONE |
  7. | JobName | TEXT | No | false | NULL | NONE |
  8. | State | TEXT | No | false | NULL | NONE |
  9. | SchemaChangeDetail | TEXT | No | false | NULL | NONE |
  10. | RefreshState | TEXT | No | false | NULL | NONE |
  11. | RefreshInfo | TEXT | No | false | NULL | NONE |
  12. | QuerySql | TEXT | No | false | NULL | NONE |
  13. | EnvInfo | TEXT | No | false | NULL | NONE |
  14. | MvProperties | TEXT | No | false | NULL | NONE |
  15. | MvPartitionInfo | TEXT | No | false | NULL | NONE |
  16. | SyncWithBaseTables | BOOLEAN | No | false | NULL | NONE |
  17. +--------------------+---------+------+-------+---------+-------+
  18. 12 rows in set (0.01 sec)
  • Id:物化视图id
  • Name:物化视图Name
  • JobName:物化视图对应的job名称
  • State:物化视图状态
  • SchemaChangeDetail:物化视图State变为SchemaChange的原因
  • RefreshState:物化视图刷新状态
  • RefreshInfo:物化视图定义的刷新策略信息
  • QuerySql:物化视图定义的查询语句
  • EnvInfo:物化视图创建时的环境信息
  • MvProperties:物化视属性
  • MvPartitionInfo:物化视图的分区信息
  • SyncWithBaseTables:是否和base表数据同步,如需查看哪个分区不同步,请使用SHOW PARTITIONS

example

  1. 查看db1下的所有物化视图
  1. mysql> select * from mv_infos("database"="db1");
  1. 查看db1下的物化视图名称为mv1的物化视图
  1. mysql> select * from mv_infos("database"="db1") where Name = "mv1";
  1. 查看db1下的物化视图名称为mv1的状态
  1. mysql> select State from mv_infos("database"="db1") where Name = "mv1";

keywords

  1. mv, infos