Manually Switch the archive WAL file in PostgreSQL

Manually switch the archive WAL log file in PostgreSQL

pg_switch_wal() is a system function which forces PostgreSQL to switch to a new WAL file


postgres=# select pg_switch_wal();
 pg_switch_wal
---------------
 0/9000078
(1 row)


postgres=# select pg_switch_wal();
 pg_switch_wal
---------------
 0/A000160
(1 row)

For check the filename with this switch id:

postgres=# SELECT pg_walfile_name(pg_switch_wal());
     pg_walfile_name
--------------------------
 00000001000000000000000B
(1 row)

Check the location for archive files:

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.