WAITLSN

WAITLSN — wait for the target LSN to be replayed

Synopsis

WAITLSN 'LSN' [ , wait_time ]

Description

WAITLSN provides a simple interprocess communication mechanism to wait for the target log sequence number (LSN) on standby in Postgres Pro databases with master-standby asynchronous replication. When run with the LSN option, the WAITLSN command waits for the specified LSN to be replayed. By default, wait time is unlimited. Waiting can be interrupted using Ctrl+C, or by shutting down the postgres server. You can also limit the wait time specifying the wait_time option, in milliseconds.

Important

The WAITLSN command is deprecated.

Parameters

LSN

Specify the target log sequence number to wait for.

wait_time

Limit the time to wait for the LSN to be replayed. The specified wait_time must be an integer and is measured in milliseconds.

Examples

Run WAITLSN from psql, limiting wait time to 10000 milliseconds:

WAITLSN '0/3F07A6B1', 10000;
NOTICE:  LSN is not reached. Try to make bigger delay.
WAITLSN

Wait until the specified LSN is replayed:

WAITLSN '0/3F07A611';
WAITLSN
-------------
 t
(1 row)

Limit LSN wait time to 500000 milliseconds, and then cancel the command:

WAITLSN '0/3F0FF791', 500000;
^CCancel request sent
NOTICE:  LSN is not reached. Try to make bigger delay.
ERROR:  canceling statement due to user request

Compatibility

There is no WAITLSN statement in the SQL standard.