Re: Truncation of UNLOGGED tables upon restart.

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: srkrishna1(at)aol(dot)com
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Truncation of UNLOGGED tables upon restart.
Date: 2018-11-01 20:58:12
Message-ID: CAKFQuwaXNVdT6N75ZbjvO8+wySn=iW5xyc3Ox+faZ=XP_gz3rw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Nov 1, 2018 at 1:49 PM Ravi Krishna <srkrishna1(at)aol(dot)com> wrote:

> Per documentation unlogged tables are not crash safe and PG will truncate
> it when it restarts after a crash. Does this apply to even read only
> unlogged tables.
>
> For example:
>
> On Monday I load data into unlogged tables.
>
> Then from Tue onwards the table is only read by application.
>
> On Fri morning PG crashes. When it restarts will it truncate all unlogged
> tables even though they remained
> unchanged. I hope it does not.

"an unlogged table is automatically truncated after a crash or unclean
shutdown." - there are no exceptions noted.

There is no such thing as a "read only" table in PostgreSQL. All tables
are read/write no matter that frequency of either event. There is nothing
inherently special about "no writes for 4 days" and "no writes for 10
seconds" that would allow for a distinction to be made. There could be
write in progress on the table just as it crashes Friday.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ravi Krishna 2018-11-01 21:20:19 Re: Truncation of UNLOGGED tables upon restart.
Previous Message Adrian Klaver 2018-11-01 20:57:01 Re: Add columns to table; insert values based on row