Please help me understand unlogged tables - Mailing list pgsql-general

From Alexander Stoddard
Subject Please help me understand unlogged tables
Date
Msg-id CADDNc-Bro0MvGxr7VTCLjryg_KxUVGT7Kt_Md1jV0jbfz1w6Kw@mail.gmail.com
Whole thread Raw
Responses Re: Please help me understand unlogged tables  (Jeff Janes <jeff.janes@gmail.com>)
Re: Please help me understand unlogged tables  (Michael Paquier <michael.paquier@gmail.com>)
List 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

pgsql-general by date:

Previous
From: "Peter J. Holzer"
Date:
Subject: Re: postgres for production
Next
From: Abhra Kar
Date:
Subject: Equivalent shell script of create user and schema in specificpostgres db