Skip to content

Retention Policies for System Relations

Some system relations can grow in space with time, because of the number of queries being run, sessions being opened, etc. We provide a retention mechanism for some of these relations:

  • Removing all records older than a given age.
  • Removing the oldest records when the relation takes more than a given amount of space in the storage.

Interface

The current retention configuration can be observed in sys.retention.

The retention history is stored in sys.log_retention.

To modify the retention configuration for a given relation, an ALTER TABLE statement needs to be run, for example:

sql
ALTER TABLE <relation> SET RETENTION_SIZE <size>

See ALTER TABLE for the complete SQL syntax.

Notes

  • The retention process will trigger every hour.
  • When removing records because of space limit, no record younger than a day will be removed.
  • The retention policy configuration does not survive upgrades and will need to be re-applied.

Default configuration

By default, the following retention policies are set up:

RelationAge RetentionSize RetentionMinimum Age RetentionMinimum Size Retention
sys.log_analyze3 months1GB1 day128MB
sys.log_authenticationDisabledDisabled1 day128MB
sys.log_backup3 months1GB1 day128MB
sys.log_cluster_event3 months1GB1 day128MB
sys.log_load3 months1GB1 day128MB
sys.log_query1 month32GB1 day1GB
sys.log_query_analyze1 month32GB1 day128MB
sys.log_query_usage1 month32GB1 day128MB
sys.log_restore3 months1GB1 day128MB
sys.log_replica_status3 months1GB1 day128MB
sys.log_retention3 months1GB1 day128MB
sys.log_sessionDisabledDisabled1 day128MB
sys.log_unload3 months1GB1 day128MB