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:

This entry was posted in PostgreSQL on by .
Unknown's avatar

About SandeepSingh

Hi, I am working in IT industry with having more than 15 year of experience, worked as an Oracle DBA with a Company and handling different databases like Oracle, SQL Server , DB2 etc Worked as a Development and Database Administrator.

Leave a Reply