From: | Jeff Janes <jeff(dot)janes(at)gmail(dot)com> |
---|---|
To: | Alexander Stoddard <alexander(dot)stoddard(at)gmail(dot)com> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Please help me understand unlogged tables |
Date: | 2018-01-31 22:44:43 |
Message-ID: | CAMkU=1zw1_PWL-P7kaCBeC8ePGCvQTjPDZ=8O5y8Awb7qm_nMA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Wed, Jan 31, 2018 at 8:52 AM, Alexander Stoddard <
alexander(dot)stoddard(at)gmail(dot)com> wrote:
> 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?
>
Yes.
> 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...
>
Right, that is the problem. It would be nice to solve it, but there are no
immediate plans that I know of to implement that. It is hard, because
during recovery the system can't query system catalog tables to get
information out of them. That is why unlogged tables are indicate by the
existence of certain files in the filesystem, so the system can know they
are unlogged without querying the system catalogs to find out.
> Would a correct solution be to bulk load into an unlogged table and then
> (fairly cheaply?) set the table back to being logged?
>
Unfortunately, it is not cheap for large tables.
I have some large datasets which I could always regenerate if needed, which
I don't want blowing out my wal archive. I've resigned myself to just
reloading them after a crash (or after using pg_basebackup to reclone
production to make a fresh test/dev server). If the ETL step from the raw
source is expensive, then I \copy the table out to a file, and then \copy
it back in after a crash, to save on the ET time.
Cheers,
Jeff
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2018-02-01 00:45:28 | Re: Please help me understand unlogged tables |
Previous Message | Michał Muskała | 2018-01-31 22:01:15 | Unexpected ErrorMessage reply to SSLRequest |