Book Image

PostgreSQL Replication, Second Edition

Book Image

PostgreSQL Replication, Second Edition

Overview of this book

Table of Contents (22 chapters)
PostgreSQL Replication Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Checking pg_stat_replication


Checking the archive and archive_command is primarily for Point-In-Time-Recovery. If you want to monitor a streaming-based setup, it is advised to keep an eye on a system view called pg_stat_replication. This view contains the following information:

test=# \d pg_stat_replication
          View "pg_catalog.pg_stat_replication"
      Column      |           Type           | Modifiers
 ------------------+--------------------------+-----------
  pid              | integer                  |
  usesysid         | oid                      |
  usename          | name                     |
  application_name | text                     |
  client_addr      | inet                     |
  client_hostname  | text                     |
  client_port      | integer                  |
  backend_start    | timestamp with time zone |
  backend_xmin     | xid                      |
  state            | text                     |
  sent_location    | pg_lsn                   |
 ...