6

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.

1 Answer 1

13

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for the information, that article is very informative.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.