The system table system.cnch_view_tables contains detailed information about all materialized views in the current database, including the definition of the materialized view, associated base tables, refresh configuration, status information, and more. This helps you monitor and manage the configuration and operational status of materialized views.
| | | | \
| Field name | Data type | Field description | |
|---|---|---|---|
| \ | |||
| database | String | The name of the database to which the materialized view belongs. | |
| \ | |||
| table | String | The name of the materialized view. | |
| \ | |||
| uuid | UUID | The globally unique identifier of the materialized view, automatically generated by the system. | |
| \ | |||
| vw_name | String | The name of the compute group used by the materialized view. | |
| \ | |||
| definition | String | The creation statement of the materialized view. | |
| \ | |||
| base_tables | Array(String) | The base tables on which the materialized view depends. | |
| \ | |||
| dependent_table | Array(String) | The partitions of the materialized view depend on the partition definitions of the base tables: if the partitions of a base table can be transformed into the partitions of the target table of the view by functions, then the view is considered to depend on this base table. | |
| \ | |||
| non_dependent_tables | Array(String) | The partitions of the base tables can only align with one of the base tables; the remaining tables are non-dependent base tables. | |
| \ | |||
| target_table | String | The name of the target table where the materialized view's data is stored. | |
| \ | |||
| partition_diffs | Array(String) | The current materialized view displays the list of partition distribution differences between this refresh and the previous refresh: add_partitions represents partitions added in this refresh, and drop_partitions represents partitions deleted in this refresh. The system automatically constructs corresponding refresh tasks based on this difference list. | |
| \ | |||
| latest_visible_partitions | Array(String) | The current partition version list information of the base tables. | |
| \ | |||
| previous_partitions | Array(String) | The list of partition versions that have been refreshed. | |
| \ | |||
| refresh_type | String | The data refresh type of the materialized view. SYNC indicates a synchronous materialized view. | |
| \ | |||
| refresh_start_time | String | The time when the materialized view started to refresh. | |
| \ | |||
| refresh_interval | String | The refresh interval of the materialized view. | |
| \ | |||
| active | UInt8 | Indicates whether the materialized view is currently in an active state. When a base table is modified and affects the materialized view, the view will be marked as inactive. A materialized view in an inactive state cannot be rewritten or refreshed, and its status cannot be directly modified. To restore normal usage, it must be deleted and recreated. | |
| \ | |||
| enable_refresh | UInt8 | Indicates whether the automatic refresh feature is enabled. 1 indicates that automatic refresh is enabled; 0 indicates that automatic refresh is disabled and manual refresh is required. | |
| \ | |||
| enable_query_rewrite | UInt8 | Indicates whether the query rewrite feature is enabled. 1 indicates that the feature is enabled, 0 indicates that the feature is disabled. | |
| \ | |||
| refresh_status | String | Indicates the current running status of the refresh task and the number of running tasks, including the status identifier (running) and the number of tasks (running_tasks). |
Query views in the specified database:
SELECT * FROM system.cnch_view_tables WHERE database = 'sales_db' LIMIT 10;
Sample query result: