PURGE_PROJECTION

从物理存储空间中永久移除已删除的数据,以便可以重新使用磁盘空间。您可以清除包含 Ancient History Mark 时期之前的历史数据。

有关清除操作的详细信息,请参阅 PURGE

这是元函数。您必须在顶级 SELECT 语句中调用元函数。

行为类型

易变

语法

PURGE_PROJECTION ( '[[database.]schema.]projection' )

参数

[database.]schema

数据库和架构。默认架构为 public。如果指定一个数据库,它必须是当前数据库。

projection
要清除的投影。

特权

  • 表所有者

  • 对架构的 USAGE 权限

示例

以下示例将清除 Ancient History Mark 时期之前的投影 tbl_p 中的所有历史数据。

=> CREATE TABLE tbl (x int, y int);
CREATE TABLE
=> INSERT INTO tbl VALUES(1,2);
 OUTPUT
--------
      1
(1 row)

=> INSERT INTO tbl VALUES(3,4);
 OUTPUT
--------
      1
(1 row)

dbadmin=> COMMIT;
COMMIT
=> CREATE PROJECTION tbl_p AS SELECT x FROM tbl UNSEGMENTED ALL NODES;
WARNING 4468: Projection <public.tbl_p> is not available for query processing.
Execute the select start_refresh() function to copy data into this projection.
The projection must have a sufficient number of buddy projections and all nodes must be up before starting a refresh
CREATE PROJECTION
=> SELECT START_REFRESH();
             START_REFRESH
----------------------------------------
 Starting refresh background process.
=> DELETE FROM tbl WHERE x=1;
 OUTPUT
--------
      1
(1 row)

=> COMMIT;
COMMIT
=> SELECT MAKE_AHM_NOW();
         MAKE_AHM_NOW
-------------------------------
 AHM set (New AHM Epoch: 9066)
(1 row)

=> SELECT PURGE_PROJECTION ('tbl_p');
 PURGE_PROJECTION
-------------------
 Projection purged
(1 row)

另请参阅