## Name

WAITLSN — wait when target LSN been replayed

## Synopsis

    WAITLSN 'LSN' [ , delay ]

## Description

The `WAITLSN` wait till target LSN will be replayed with an optional “delay” (milliseconds by default infinity) to be wait for LSN to replayed.

`WAITLSN` provides a simple interprocess LSN wait mechanism for a backends on slave in master-slave replication scheme on Postgres Pro database.

## Parameters

`LSN`

  Target log sequence number to be wait for.

`delay`

  Time to wait for LSN to be replayed, in milliseconds.

## Notes

Delay time to waiting for LSN to be replayed must be integer. For default it is infinity. Waiting can be interrupted using Ctl+C, or by Postmaster death.

## Examples

Configure and execute a waitlsn from psql:

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

    WAITLSN '0/3F07A611';
    WAITLSN

    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.