aokolnychyi opened a new issue #1597:
URL: https://github.com/apache/iceberg/issues/1597


   Until we have a proper VACUUM command, we can expose a stored procedure for 
expiring snapshots. 
   
   ```
   CALL catalog.schema.expire_snapshots(
     namespace  => 'namespace_name'
     table => 'table_name',
     older_than => timestamp,
     retain_last => number
   )
   ```
   
   The output from this command may include the number of deleted data, 
manifest, manifest list files.
   
   I think we should make the older_than and retain_last args optional and 
require at least one to be present. It seems Presto recently added support for 
optional args in procedures. 
   
   Then we can expire snapshots that are older than a given interval:
   
   ```
   CALL catalog.schema.expire_snapshots(
     namespace => 'namespace_name',
     table => 'table_name',
     older_than => CURRENT_TIMESTAMP() - INTERVAL '7' DAYS
   )
   ```
   
   We can also provide a minimum number of snapshots to keep:
   
   ```
   CALL catalog.schema.expire_snapshots(
     namespace => 'namespace_name',
     table => 'table_name',
     older_than => CURRENT_TIMESTAMP() - INTERVAL '7' DAYS,
     retain_last => 100
   )
   ```
   
   Or just give a number of snapshots to keep:
   
   ```
   CALL catalog.schema.expire_snapshots(
     namespace => 'namespace_name',
     table => 'table_name',
     retain_last => 100
   )
   ```
   
   Or give a specific point in time:
   
   ```
   CALL catalog.schema.expire_snapshots(
     namespace => 'namespace_name',
     table => 'table_name',
     older_than => TIMESTAMP '2020-01-19 03:14:07',
     retain_last => 100
   )
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to