Please help me understand unlogged tables

From: Alexander Stoddard <alexander(dot)stoddard(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Please help me understand unlogged tables
Date: 2018-01-31 16:52:38
Message-ID: CADDNc-Bro0MvGxr7VTCLjryg_KxUVGT7Kt_Md1jV0jbfz1w6Kw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If a table is set to unlogged is it inherently non-durable? That, is any
crash or unsafe shutdown _must_ result in truncation upon recovery?

I can imagine a table that is bulk loaded in a warehousing scenario and
then sitting statically could be safe, but maybe the question becomes how
could the system know it is unchanged if it isn't logged...

Would a correct solution be to bulk load into an unlogged table and then
(fairly cheaply?) set the table back to being logged?

If I my mental model is correct the table would be liable to being lost to
a crash during loading but once set back to logged it is durable. Is that
correct?

Is it the case that setting a large table to logged status after loading it
unlogged is a reasonably cheap operation?

Thank you,
Alex Stoddard

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Abhra Kar 2018-01-31 16:57:53 Equivalent shell script of create user and schema in specific postgres db
Previous Message Peter J. Holzer 2018-01-31 16:32:46 Re: postgres for production