REMOVE_ICEBERG_VIEW_SNAPSHOTS¶
Description
The stored procedure REMOVE_ICEBERG_VIEW_SNAPSHOTS removes the desired snapshot metadata information associated with the table pointed by the given view.
Syntax
REMOVE_ICEBERG_VIEW_SNAPSHOTS (
database_name : text,
view_name : text,
older_than : timestamp,
retain_last : integer,
snapshot_ids : array(bigint)
)
database_name
: name of the database containing the view. If the database does not exist the procedure returns an error.view_name
: name of the view. If the view does not exist the procedure returns an error.older_than
(optional): timestamp before which snapshots will be removed. Default value: 5 days ago.retain_last
(optional): number of ancestor snapshots to preserve regardless ofolder_than
value. Default value: 1.snapshot_ids
(optional): array of snapshot IDs to expire.
This stored procedure return one row, with the following schema:
success
:true
if the procedure executed successfully,false
otherwise.error_description
: if the procedure execution resulted in an error, this field shows an error description.
Privileges required
Only users that have Delete privileges on the base view can execute this procedure. This means, the following users can execute this procedure:
Administrators or administrators on the database.
Users that have Connect privilege on the database and Delete privileges on the base view.
Examples
Execute procedure on view
test_database.test_view
with the default parameters:CALL REMOVE_ICEBERG_VIEW_SNAPSHOTS('test_database', 'test_view')
.Execute procedure on view
test_database.test_view
removing snapshots older than 20 days if current timestamp is 30-01-2025:CALL REMOVE_ICEBERG_VIEW_SNAPSHOTS('test_database', 'test_view', '10-01-2025 12:13:14')
.Execute procedure on view
test_database.test_view
removing snapshots preserving a minimum of 10 snapshots:CALL REMOVE_ICEBERG_VIEW_SNAPSHOTS('test_database', 'test_view', null, 10)
.Execute procedure on view
test_database.test_view
removing specific snapshot IDs:CALL REMOVE_ICEBERG_VIEW_SNAPSHOTS('test_database', 'test_view', null, null, {123415512341431, 123412514623421})
.