mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
18 lines
608 B
MySQL
18 lines
608 B
MySQL
|
-- Get last successful backup for each stanza
|
||
|
--
|
||
|
-- Requires the monitor.pgbackrest_info function.
|
||
|
with stanza as
|
||
|
(
|
||
|
select data->'name' as name,
|
||
|
data->'backup'->(
|
||
|
jsonb_array_length(data->'backup') - 1) as last_backup,
|
||
|
data->'archive'->(
|
||
|
jsonb_array_length(data->'archive') - 1) as current_archive
|
||
|
from jsonb_array_elements(monitor.pgbackrest_info()) as data
|
||
|
)
|
||
|
select name,
|
||
|
to_timestamp(
|
||
|
(last_backup->'timestamp'->>'stop')::numeric) as last_successful_backup,
|
||
|
current_archive->>'max' as last_archived_wal
|
||
|
from stanza;
|