云数据库 GAUSSDB-SNAPSHOT:语法格式

时间:2024-11-02 18:50:37

语法格式

  1. 创建快照

    可以采用“CREATE SNAPSHOT … AS”以及“CREATE SNAPSHOT … FROM”语句创建数据表快照。

    • CREATE SNAPSHOT AS
      CREATE SNAPSHOT qualified_name [@ [version]]
          [COMMENT IS comment_item]
          AS query;
    • CREATE SNAPSHOT FROM
      CREATE SNAPSHOT qualified_name [@ [version]]
          FROM @ version
          [COMMENT IS comment_item]
              USING (
              { INSERT [INTO SNAPSHOT] insert_item
                | UPDATE [SNAPSHOT] [AS alias] SET set_item [FROM from_item] [WHERE where_item]
                | DELETE [FROM SNAPSHOT] [AS alias] [USING using_item] [WHERE where_item]
                | ALTER [SNAPSHOT] { ADD and_item | DROP drop_item } [, ...]
            } [; ...]
          );
  2. 删除快照。
    PURGE SNAPSHOT
    PURGE SNAPSHOT qualified_name @ version;
  3. 快照采样。
    SAMPLE SNAPSHOT
    SAMPLE SNAPSHOT qualified_name @ version
        [STRATIFY BY attr_list]
        { AS alias AT RATIO num [COMMENT IS comment_item] } [, ...]
  4. 快照发布。
    PUBLISH SNAPSHOT
    PUBLISH SNAPSHOT qualified_name @ version;
  5. 快照存档。
    ARCHIVE SNAPSHOT
    ARCHIVE SNAPSHOT qualified_name @ version;
  6. 查询快照。
    SELECT * FROM DB4AISHOT (qualified_name @ version );
support.huaweicloud.com/centralized-devg-v3-gaussdb/gaussdb-12-0649.html