pg_switch_wal example
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Sep 2021 13:24:39 +0000 (15:24 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 11 Sep 2021 13:24:39 +0000 (15:24 +0200)
db.txt

diff --git a/db.txt b/db.txt
index ad4764e..52a7fef 100644 (file)
--- a/db.txt
+++ b/db.txt
@@ -192,6 +192,33 @@ su postgres -c '/usr/pgsql-10/bin/pg_ctl -D /tmp/r start -o "-p 5433"'
 su postgres -c '/usr/pgsql-10/bin/pg_ctl -D /tmp/r stop'
 
 
+# wal introspection
+
+## current wal filename on master
+
+SELECT pg_walfile_name(pg_current_wal_lsn());
+
+## switch to next wal file
+
+dpavlin=# SELECT pg_walfile_name(pg_current_wal_lsn());
+     pg_walfile_name
+--------------------------
+ 000000010000000000000020
+(1 row)
+
+dpavlin=# select pg_switch_wal();
+ pg_switch_wal
+---------------
+ 0/20B48BA8
+(1 row)
+
+dpavlin=# SELECT pg_walfile_name(pg_current_wal_lsn());
+     pg_walfile_name
+--------------------------
+ 000000010000000000000021
+(1 row)
+
+
 
 # TODO