sys.backup_chain

This system view returns a list of all backup chains in the current database.

Column Name Data Type Description
database_id bigint The unique ID for the database.
chain_name text Name of the backup chain. This view contains records for backup chains associated with database replicas and/or defined with ybbackup operations. In the replication case, the default chain name is the same as the replica name. For backups, the chain name is as specified in the ybbackup command.
policy text Empty JSON string {}, except for backup chains that exclude schemas (ybbackup --exclude option). When schemas are excluded, this column contains a string of the following form: {"excludedSchemas":["schema1","schema2"]}
oldest_backup_point_id text Unique ID for the oldest backup point for this database. (Without this backup snapshot, the backup chain cannot function.)
oldest_rollback_point_id text Unique ID for the oldest backup point that this database can be rolled back to with the ROLLBACK DATABASE command.
inprogress_backup_point_id text Unique ID for a backup that is in progress, if any.
creation_time timestamptz When the backup chain was created.
For example, here is an example from a system running regular backups:
premdb=# select * from sys.backup_chain;
 database_id |  chain_name  | policy | oldest_backup_point_id | oldest_rollback_point_id |         creation_time          
-------------+--------------+--------+------------------------+--------------------------+-------------------------------
       16391 | December2019 | {}     | Dec17Full              | [NULL]                   | 2019-12-17 18:03:01.511742-08
(1 row)
Here is an example from a system running database replication:
premdb=# select * from sys.backup_chain;
 database_id |      chain_name       | policy |         oldest_backup_point_id          |        oldest_rollback_point_id         |         creation_time          
-------------+-----------------------+--------+-----------------------------------------+-----------------------------------------+-------------------------------
       16432 | premdb_local_replica1 | {}     | premdb_local_replica1_20_01_14_00_50_56 | premdb_local_replica1_20_01_14_00_50_56 | 2020-01-13 16:06:55.880816-08
(1 row)
The following example shows the chain for a full backup that excludes two schemas:
premdb=# select * from sys.backup_chain;
 database_id | chain_name |                  policy                  |    oldest_backup_point_id     | oldest_rollback_point_id | inprogress_backup_point_id |         creation_time         
-------------+------------+------------------------------------------+-------------------------------+--------------------------+----------------------------+-------------------------------
       16396 | May2022    | {"excludedSchemas":["sys","matchstats"]} | May23FullExcludeSysMatchstats | [NULL]                   | [NULL]                     | 2022-05-23 20:43:56.618988+00
(1 row)