Starting from V3.0, Hologres supports manual or automatic data refresh for dynamic tables through the REFRESH DYNAMIC TABLE statement.
Syntax
Executing a refresh operation once is considered a manual refresh. If a refresh policy is configured when you execute the CREATE DYNAMIC TABLE statement, it is an automatic refresh.
--Refresh syntax supported in all versions
REFRESH DYNAMIC TABLE [<schema_name>.]<table_name>;
--Refresh syntax supported from V3.1
REFRESH [OVERWRITE] DYNAMIC TABLE [<schema_name>.]<table_name>
[PARTITION (<partition_key> = '<partition_value>') ]
[WITH (
refresh_mode = '{full|incremental}'
)];The following table describes the parameters.
Parameter | Description |
schema_name | The name of the schema in which the table resides. |
table_name | The name of the non-partitioned table or partitioned child table. |
OVERWRITE | Supports the overwrite syntax for the dynamic table. Note This parameter is only supported in Hologres V3.1 and later. |
PARTITION (<partition_key> = '<partition_value>') | Configuration when the table is a partitioned table. partition_key specifies the partition key, and partition_value specifies the corresponding partition value. |
WITH ( refresh_mode = '{full|incremental}' ) | The refresh mode during the refresh operation. Note This parameter is only supported in Hologres V3.1 and later. |
computing_resource={'local' | 'serverless' | 'warehouse_name'} | Specifies the resources to use for the refresh operation. For more information, see Set refresh resources for a dynamic table. Valid values:
|
For partitioned tables, you must include the partition field and can only refresh a single partition at a time.
When a dynamic table is in different refresh modes, the effects of manually executing the refresh syntax are as follows.
Statement
Behavior when the table is in incremental refresh mode
Behavior when the table is in full refresh mode
refresh
Executes incremental refresh.
Executes full refresh.
refresh overwrite
Re-executes incremental refresh without preserving the previous state.
Executes full refresh.
refresh with full
Reports an error.
Executes full refresh.
refresh with incremental
Executes incremental refresh.
Reports an error.
refresh overwrite with incremental
Re-executes incremental refresh without preserving the previous state.
Reports an error.
refresh overwrite with full
Executes full refresh and stops incremental refresh.
Executes full refresh.
Limitations
If the dynamic table is a regular partitioned table, only the REFRESH DYNAMIC TABLE statement is supported. You cannot refresh the parent table, but can refresh child tables.
When the dynamic table is a logical partitioned table:
If
refresh_modeis specified during manual refresh, the system will change the refresh mode of the partition to the specified mode after the refresh, and automatic refresh will no longer be executed for this partition.After OVERWRITE is executed, the partition state will be cleared, and the specified partition data will be refreshed again.