postgres logical replication verify monitoring pglogical - ghdrako/doc_snipets GitHub Wiki
active
column. If a slot does not have a connection to a consumer, the column will be false
.
select slot_name,pg_size_pretty(pg_current_wal_lsn() - confirmed_flush_lsn) FROM pg_replication_slots WHERE slot_type = 'logical';
show cloudsql.enable_pglogical; # verify logical replication enable
select * from pglogical.node;
select * from pglogical.local_node;
select * FROM pglogical.node_interface; # show node
SELECT * FROM pglogical.node_interface where if_name = 'provider';
select * FROM pg_replication_slots; # show slots
select * from pglogical.replication_set;
select * from pglogical.replication_set_table;
SELECT * FROM pglogical.replication_set_table
WHERE set_id = (select set_id from pglogical.replication_set where set_name='default');
SELECT data FROM pg_logical_slot_get_changes('repl_slot1', NULL, NULL, 'pretty-print', '1'); # show data in slot
select pg_drop_replication_slot('repl_slot2') from pg_replication_slots where slot_name = 'repl_slot2';
select pg_drop_replication_slot('<slot_name>') from pg_replication_slots where slot_name = '<slot_name>';
SELECT * FROM pg_create_logical_replication_slot('repl_slot2', 'wal2json');
SELECT count(*) FROM pg_logical_slot_get_changes('repl_slot1', NULL, NULL, 'pretty-print', '1')
union all
SELECT count(*) FROM pg_logical_slot_get_changes('repl_slot2', NULL, NULL, 'pretty-print', '1')
union all
SELECT count(*) FROM pg_logical_slot_get_changes('repl_slot3', NULL, NULL, 'pretty-print', '1')
union all
SELECT count(*) FROM pg_logical_slot_get_changes('repl_slot4', NULL, NULL, 'pretty-print', '1')