Advertisement
rockdrilla

[PostgreSQL 10] compact pg_wal (former pg_xlog)

Oct 12th, 2017
484
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. # du -xhd1 /var/lib/postgresql/10/main | grep -F M
  2. 36M /var/lib/postgresql/10/main/base
  3. 769M /var/lib/postgresql/10/main/pg_wal
  4. 804M /var/lib/postgresql/10/main
  5.  
  6. # service postgresql stop
  7. [ ok ] Stopping PostgreSQL 10 database server: main.
  8.  
  9. # /usr/lib/postgresql/10/bin/pg_controldata /var/lib/postgresql/10/main 2>&1 | grep Next
  10. Latest checkpoint's NextXID: 0:2181
  11. Latest checkpoint's NextOID: 19544
  12. Latest checkpoint's NextMultiXactId: 1
  13. Latest checkpoint's NextMultiOffset: 0
  14.  
  15. # sudo -u postgres /usr/lib/postgresql/10/bin/pg_resetwal -o 19544 -x 2181 -f /var/lib/postgresql/10/main/
  16. Write-ahead log reset
  17.  
  18. # du -xhd1 /var/lib/postgresql/10/main | grep -F M
  19. 36M /var/lib/postgresql/10/main/base
  20. 17M /var/lib/postgresql/10/main/pg_wal
  21. 52M /var/lib/postgresql/10/main
  22.  
  23. # service postgresql start
  24. [ ok ] Starting PostgreSQL 10 database server: main.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement