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)?


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.

| improve this answer | |
  • Where are theses transaction logs (WAL) located? Is it possible to send these logs from a primary site and run them on a secondary site? – Saad Khan Feb 27 '17 at 13:36
  • I want to start sending changes after a certain time. Unfortunately, I have already implemented streaming replication but the problem is that it completely replicates the primary to the secondary. I don't want that! I want changes after a certain point to be sent to the secondary, not fully replicating primary to secondary. Can that be done? – Saad Khan Feb 27 '17 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.