pg_switch_wal() is a system function which forces PostgreSQL to switch to a new WAL file.
pg_switch_wal() returns the end LSN + 1 of
the old WAL file.
However, if there has been no activity
which generates WAL since the last WAL file switch, a switch will not be
carried out and the start location of the current WAL file will be returned.
pg_switch_wal() can only be executed on a
primary server (i.e. not a read-only standby).
postgres=# SELECT pg_switch_wal();
pg_switch_wal
---------------
0/161E050
If there
has been no activity which generated WAL since the last WAL file switch, a new
WAL file will not be created:
postgres=#
SELECT pg_walfile_name(pg_switch_wal()), pg_walfile_name(pg_switch_wal());
pg_walfile_name |
pg_walfile_name
--------------------------+--------------------------
000000010000000200000086 |
000000010000000200000086
(1
No comments:
Post a Comment
If you have any doubt or question, please contact us.