Can I use unlogged tables on Heroku Postgres?

Issue

You would like to use unlogged tables on Heroku Postgres.

Resolution

Creating unlogged tables on Heroku Postgres (CREATE UNLOGGED TABLE) is heavily advised against. Unlogged tables are not crash safe, and will be truncated in the event of a crash or otherwise unclean shutdown, losing all data in the unlogged table in the process. Any indexes created on an unlogged table are automatically unlogged as well.

Additionally, as they are not written to the write-ahead log (WAL), they are not covered by Continuous Protection (ref: https://devcenter.heroku.com/articles/heroku-postgres-data-safety-and-continuous-protection).

Finally, as a consequence of not being written to the write-ahead log, unlogged tables are not replicated to followers or the High-Availabiltiy standby for Premium/Private/Shield plans.

This makes data recovery in unlogged tables impossible in the cases of maintenance operations, as well the aforementioned crashes and unclean shutdowns.

Ask on Stack Overflow

Engage with a community of passionate experts to get the answers you need

Ask on Stack Overflow

Heroku Support

Create a support ticket and our support experts will get back to you

Contact Heroku Support