Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the postgresql wal located? How can I specify a different path?

Tags:

postgresql

I want to create a database with the data files and the wal on different filesystems. I want the wal on a separate server over NFS, to avoid a loss of data in case of a fs/disk crash.

Where is the wal written?

Can I force it to a different location than the default via the configuration?

I'm on 9.1 if that matters.

Thanks.

like image 994
Yves Dorfsman Avatar asked Sep 27 '13 09:09

Yves Dorfsman


1 Answers

The WAL files are written to the directory pg_xlog inside of the data directory. Starting with Postgres 10, this directory was renamed to pg_wal

E.g. /var/lib/postgresql/10/main/pg_wal

See the manual for details:

  • http://www.postgresql.org/docs/9.1/static/wal-configuration.html
  • http://www.postgresql.org/docs/current/static/wal-configuration.html

If I'm not mistaken, this directory name can not be changed. But it can be a symbolic link that points to a different disk.

As a matter of fact this is actually recommended to tune WAL performance (See here: http://wiki.postgresql.org/wiki/Installation_and_Administration_Best_practices#WAL_Directory)

like image 188
a_horse_with_no_name Avatar answered Oct 21 '22 15:10

a_horse_with_no_name