Michael Payne
Michael Payne

Reputation: 544

Postgres Replication and Temporary Tables

If I create a temporary table inside of a transaction, populate it with the COPY command, and use the ON COMMIT DROP option, does the table data still get written to the WAL and get replicated to the slave database? I'm doing a fairly large import, doing some work using that data, and then I don't need it anymore. I don't want to rollback the whole transaction because I want to keep the work that was done using the source data, but I won't need the source data again and so I don't want to waste time and bandwidth replicating and deleting it on the slave.

Upvotes: 6

Views: 4190

Answers (1)

Erwin Brandstetter
Erwin Brandstetter

Reputation: 658022

Temporary tables are not WAL-logged in PostgreSQL.

You might be interested in this article by Robert Haas (PostgreSQL core developer) about unlogged tables - that also clarifies the behavior of temporary tables.

Upvotes: 13

Related Questions