SYS_MV_STATE - Amazon Redshift
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

SYS_MV_STATE

结果包括有关所有实体化视图的状态的信息。这包括基表信息、架构属性和有关最近事件(例如删除列)的信息。

SYS_MV_STATE 对所有用户均可见。超级用户可以查看所有行;普通用户只能查看其自己的数据。有关更多信息,请参阅系统表和视图中的数据可见性

表列

列名称 数据类型 描述
user_id bigint 创建事件的用户的 ID。
transaction_id bigint 事件的事务 ID。
database_name char(128) 包含实体化视图的数据库。
event_desc char(500) 提示状态更改的事件。示例值包括:
  • 列类型已更改

  • 列已被删除

  • 列已重命名

  • 架构名称已更改

  • 小型表转换

  • TRUNCATE

  • Vacuum

请注意,此列有其它可能的值。
start_time 时间戳 事件的开始时间。
base_table_database_name char(128) 基表的数据库名称。
base_table_schema char(128) 基表的架构。
base_table_name char(128) 基表的名称。
mv_schema char(128) 实体化视图的架构。
mv_name char(128) 实体化视图的名称。
state character(32) 实体化视图的已更改状态,如下所示:
  • 重新计算

  • 无法刷新

示例查询

以下查询显示了实体化视图状态。

select * from sys_mv_state;

查询返回以下示例输出:

user_id | transaction_id | database_name | event_desc | start_time | base_table_database_name | base_table_schema | base_table_name | mv_schema | mv_name | state ---------+----------------+---------------+-----------------------------+----------------------------+--------------------------+-------------------+---------------------+-------------+----------------------------+-------------- 106 | 12720 | tickit_db | TRUNCATE | 2023-07-26 14:59:12.788268 | tickit_db | mv_schema | test_table_95d6d861 | mv_schema | materialized_view_a1f3f862 | Recompute 106 | 12724 | tickit_db | ALTER TABLE ALTER DISTSTYLE | 2023-07-26 14:59:51.409014 | tickit_db | mv_schema | test_table_58102435 | mv_schema | materialized_view_ca746631 | Recompute 106 | 12720 | tickit_db | Column was renamed | 2023-07-26 14:59:12.822928 | tickit_db | mv_schema | test_table_95d6d861 | mv_schema | materialized_view_5750a8d4 | Unrefreshable 106 | 12727 | tickit_db | Table was renamed | 2023-07-26 15:00:08.051244 | tickit_db | mv_schema | test_table_95d6d861 | mv_schema | materialized_view_5750a8d4 | Unrefreshable 106 | 12720 | tickit_db | Column was renamed | 2023-07-26 14:59:12.857755 | tickit_db | mv_schema | test_table_95d6d861 | mv_schema | materialized_view_5750a8d4 | Unrefreshable 106 | 12727 | tickit_db | Table was renamed | 2023-07-26 15:00:08.051358 | tickit_db | mv_schema | test_table_95d6d861 | mv_schema | materialized_view_5ef0d754 | Unrefreshable 106 | 12720 | tickit_db | TRUNCATE | 2023-07-26 14:59:12.788159 | tickit_db | mv_schema | test_table_95d6d861 | mv_schema | materialized_view_5750a8d4 | Recompute 106 | 12720 | tickit_db | Column was renamed | 2023-07-26 14:59:12.857799 | tickit_db | mv_schema | test_table_95d6d861 | mv_schema | materialized_view_a1f3f862 | Unrefreshable 106 | 12720 | tickit_db | TRUNCATE | 2023-07-26 14:59:12.788327 | tickit_db | mv_schema | test_table_95d6d861 | mv_schema | materialized_view_5ef0d754 | Recompute 106 | 12727 | tickit_db | ALTER TABLE ALTER SORTKEY | 2023-07-26 15:00:08.006235 | tickit_db | mv_schema | test_table_58102435 | mv_schema | materialized_view_ca746631 | Recompute 106 | 12720 | tickit_db | Column was renamed | 2023-07-26 14:59:12.82297 | tickit_db | mv_schema | test_table_95d6d861 | mv_schema | materialized_view_a1f3f862 | Unrefreshable 106 | 12727 | tickit_db | Table was renamed | 2023-07-26 15:00:08.051321 | tickit_db | mv_schema | test_table_95d6d861 | mv_schema | materialized_view_a1f3f862 | Unrefreshable