Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Checking PostgreSQL Replication Delay

You can get the delay in bytes from the master side quite easily using pg_xlog_location_diff to compare the master's pg_current_xlog_insert_location with the replay_location for that backend's pg_stat_replication entry.

postgres=# SELECT
 pg_last_xlog_receive_location() receive,
 pg_last_xlog_replay_location() replay,
 (
  extract(epoch FROM now()) -
  extract(epoch FROM pg_last_xact_replay_timestamp())
 )::int lag;

 receive   |   replay   |  lag
------------+------------+-------
1/AB861728 | 1/AB861728 | 2027

the lag is only only important when receive is different than replay. execute the query on the slave


Comments

Popular posts from this blog

Pgbadger Feature In Postgresql

rman interview and scenario based questions and answer and also rman(backup and recovery) discussions panel

ERROR: operator does not exist: text ->> unknown LINE 1: ...stomer' as customer_name,sales_info ->>'PRODUCTS' ->>'produc... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.

PostgreSQL Enterprise Manager - PEM Monitoring Tools

VMWARE WORKSTATION 3,4,5,6,7,8,9,10,11,12,14,15...etc LICENSE KEYS COLLECTION