May 2018
Intermediate to advanced
576 pages
30h 25m
English
The pg_stat_replication view shows only the currently connected nodes. If a node is supposed to be connected but it isn't, then there is no record of it at all, anywhere. If you don't have a list of the nodes that are supposed to be connected, then you'll just miss it.
Replication slots give you a way to define which connections are supposed to be present. If you have defined a slot and it is currently connected, then you will get one row in pg_stat_replication for the connection and one row in pg_replication_slots for the corresponding slot. To find out which slots don't have current connections, you can run this query:
SELECT slot_name, database, age(xmin), age(catalog_xmin) FROM pg_replication_slots WHERE NOT active;
To find ...