Is it possible to execute a Wal log that is copied from a machines pg_xlogs directory and all the queries inside it are executed on another machine? What command might be used to carry out this action (if there is any command)?
Postgresql – How to we execute a log file from pg_xlogs directory postgresql
postgresqlUbuntuwrite-ahead-logging
Related Question
- Postgresql – Create log file only for the executed queries
- PostgreSQL – Replication with Periodic Log Shipping
- Postgresql – Repopulating PostgreSQL database with data directory from another database Instance
- PostgreSQL Log Shipping Replication Stuck on Startup – How to Fix
- Postgresql – How to purge old files from pg_xlogs directory
- PostgreSQL – Configuring wal_archive Directory for Write-Ahead Logging
- PostgreSQL – WAL Segment File Creation and Naming Conventions
Best Answer
No, it doesn't work like that.
The transaction logs don't contain queries. They contain the changes to disk blocks - heap and indexes - along with records of transaction ID allocations, commits, etc. It's all very low level, and it makes absolutely no sense to try to apply it to another unrelated PostgreSQL instance.
You can use the transaction logs (WAL) for replication, per the PostgreSQL manual.
PostgreSQL also has the beginnings of logical replication functionality. Currently that's mainly accessible via 3rd party tools like pglogical. There are trigger-based alternatives like Londiste too.