WAITLSN
WAITLSN — wait for the targetLSN to be replayed
Synopsis
WAITLSN 'LSN
' [ INFINITELY ]WAITLSN 'LSN
' TIMEOUTwait_time
WAITLSN 'LSN
' NOWAIT
Description
TheWAITLSN
provides a simple interprocess communication mechanism to wait for the target log sequence number (LSN) on standby inPostgres Pro databases with master-standby asynchronous replication. When run with theLSN
option, theWAITLSN
command waits for the specifiedLSN to be replayed. By default, wait time is unlimited. Waiting can be interrupted usingCtrl+C
, or by shutting down thepostgres
server. You can also limit the wait time using theTIMEOUT
option, or check the targetLSN status immediately using theNOWAIT
option.Important
WAITLSN
command is deprecated.
Parameters
LSN
Specify the target log sequence number to wait for.
- INFINITELY
Wait until the targetLSN is replayed on standby. This is an optional parameter reinforcing the default behavior.
- TIMEOUT
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.- NOWAIT
Report whether the targetLSN has been replayed already, without any waiting.
- TIMEOUT
Examples
RunWAITLSN
frompsql, limiting wait time to 10000 milliseconds:
WAITLSN '0/3F07A6B1' TIMEOUT 10000;NOTICE: LSN is not reached. Try to increase wait time.LSN reached------------- f(1 row)
Wait until the specifiedLSN is replayed:WAITLSN '0/3F07A611';LSN reached------------- t(1 row)
Compatibility
There is noWAITLSN
statement in the SQL standard.