Skip to content

Lint for replication lag #131

Description

@chasers

Need a lint for replication lag.

Something like:

SELECT
    pid,
    usename,
    application_name,
    client_addr,
    state,
    sync_state,
    replay_lag,
    flush_lag,
    write_lag,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), sent_lsn))      AS sent_lag_size,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), write_lsn))     AS write_lag_size,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), flush_lsn))     AS flush_lag_size,
    pg_size_pretty(pg_wal_lsn_diff(pg_current_wal_lsn(), replay_lsn))    AS replay_lag_size
FROM pg_stat_replication;

Could probably do something different on the primary vs a replica.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions