# Configuring retention times in cr.yaml

**URL:** <https://forums.percona.com/t/configuring-retention-times-in-cr-yaml/33183>\
**Category:** Percona Operator for PostgreSQL\
**Created:** [September 17, 2024, 7:08am UTC](https://forums.percona.com/t/configuring-retention-times-in-cr-yaml/33183 "2024-09-17T07:08:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fragment2](https://avatars.discourse-cdn.com/v4/letter/f/b5ac83/32.png) [@Fragment2](https://forums.percona.com/u/Fragment2)\
**Post date:** [September 17, 2024, 7:08am UTC](https://forums.percona.com/t/configuring-retention-times-in-cr-yaml/33183/1 "2024-09-17T07:08:07Z")

</div>

## Description:

The documentation here:

> **[Percona Operator for PostgreSQL](https://docs.percona.com/percona-operator-for-postgresql/latest/)**
>
> The Percona Operator for PostgreSQL  
> automates the creation, modification, or deletion of items in your Percona
> Distribution for PostgreSQL environment. The Operator contains the necessary
> Kubernetes settings to maintain a consistent PostgreSQL...

only speaks of retention for full and differentials.

I have setup two repo’s with schedules as follows:

```yaml
      repos:
      - name: repo1
        schedules:
          full: "0 1 1 * *" # Monthly full backup on the 1st of each month
          differential: "0 0 * * 0" # Weekly differential backup on Sundays
          incremental: "0 0 * * 1-6" # Daily incremental backups from Monday to Saturday
        volume:
          ...
      - name: repo2
        schedules:
          full: "0 1 1 * *" # Monthly full backup on the 1st of each month
          differential: "0 0 * * 0" # Weekly differential backup on Sundays
          incremental: "0 0 * * 1-6" # Daily incremental backups from Monday to Saturday
        s3:
         ...

```

I would like the repo1 to be fast, online backup with short retention times. The S3 is offsite, with loads of spinning rust storage. This should keep long retention.

The retention is setup as follows:

```yaml
      global:
        repo1-retention-full: "1"
        repo1-retention-full-type: "count"
        repo1-retention-diff: "5"
        repo1-retention-diff-type: "count"
        repo1-retention-incr: "31"
        repo1-retention-incr-type: "count"
        repo2-retention-full: "12"
        repo2-retention-full-type: "count"
        repo2-retention-diff: "9"
        repo2-retention-diff-type: "count"
        repo2-retention-incr: "31"
        repo2-retention-incr-type: "count"
        repo1-path: /pgbackrest/repo1
        repo2-s3-uri-style: path

```

However the retention spec generated warnings. Initially because I used full names like `repo1-retention-differential` and `repo1-retention-incremental`.

I looked up the docs and looked at the full Operator CRD reference documentation and noticed that the backup retention documentation I linked only speaks of `full` and `diff` shortname retention key names but the CRD reference makes no mention of retention at all?

I assume the shortname for incremental is `incr`, but there is no way to verify whether that is actually correct.

Link:

> **[Percona Operator for PostgreSQL](https://docs.percona.com/percona-operator-for-postgresql/latest/)**
>
> The Percona Operator for PostgreSQL  
> automates the creation, modification, or deletion of items in your Percona
> Distribution for PostgreSQL environment. The Operator contains the necessary
> Kubernetes settings to maintain a consistent PostgreSQL...

## Version:

2.4.1

## Expected Result:

I expected the documentation to provide a more complete explanation of the possible retention options. In particular the CRD documentation seems incomplete.

## Actual Result:

I hope to be able to setup retention count as illustrated in the `global` part of my config above.

## Additional Information:

Is it possible to set retention for incrementals? I assume my config is correct this way, but there is no way to verify as the docs make no mention of incremental retention. For me this is trial and error right now and hoping my config is correct.

Thanks for your time!

ps. I just noticed the same is true for incremental schedules. The CRD reference speaks of full and differential, but no mention for incremental schedules. The `cr.yaml` does contain an example for incremental so it does exist 😉 .

---

<div class="post-metadata">

**Author:** ![Slava\_Sarzhan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/slava_sarzhan/32/3196_2.png) [@Slava\_Sarzhan](https://forums.percona.com/u/Slava_Sarzhan)\
**Post date:** [September 17, 2024, 4:26pm UTC](https://forums.percona.com/t/configuring-retention-times-in-cr-yaml/33183/2 "2024-09-17T16:26:16Z")

</div>

Hi @Fragment2 As you can see from pgbackrest official documentation [pgBackRest User Guide - Debian & Ubuntu](https://pgbackrest.org/user-guide.html#retention)  
`Incremental backups cannot be expired independently — they are always expired with their related full or differential backup.`

---

<div class="post-metadata">

**Author:** ![Slava\_Sarzhan](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/slava_sarzhan/32/3196_2.png) [@Slava\_Sarzhan](https://forums.percona.com/u/Slava_Sarzhan)\
**Post date:** [September 17, 2024, 4:32pm UTC](https://forums.percona.com/t/configuring-retention-times-in-cr-yaml/33183/3 "2024-09-17T16:32:47Z")

</div>

> [@Fragment2](#):
>
> ifferential

P.S. I have created the task to improve our documentation [[K8SPG-641] - Percona JIRA](https://perconadev.atlassian.net/browse/K8SPG-641)
