pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Truncation of UNLOGGED tables upon restart.
Date: Thu, 1 Nov 2018 16:29:57 -0500
Message-ID: <fbee8f47-ce39-8d6d-132d-833134399438@gmail.com> (raw)
In-Reply-To: <CAKFQuwaXNVdT6N75ZbjvO8+wySn=iW5xyc3Ox+faZ=XP_gz3rw@mail.gmail.com>
References: <1951433141.20816140.1541105355093.ref@mail.yahoo.com>
	<1951433141.20816140.1541105355093@mail.yahoo.com>
	<CAKFQuwaXNVdT6N75ZbjvO8+wySn=iW5xyc3Ox+faZ=XP_gz3rw@mail.gmail.com>

On 11/01/2018 03:58 PM, David G. Johnston wrote:
> On Thu, Nov 1, 2018 at 1:49 PM Ravi Krishna <srkrishna1@aol.com 
> <mailto:srkrishna1@aol.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.

Too bad you can't say ALTER TABLESPACE foo SET READONLY = false;

That would effectively give you read only tables.  I've done that before on 
the legacy RDBMS I managed.

-- 
Angular momentum makes the world go 'round.

view thread (7+ messages)  latest in thread

Message-ID: <fbee8f47-ce39-8d6d-132d-833134399438@gmail.com>
Permalink:  ../fbee8f47-ce39-8d6d-132d-833134399438@gmail.com/
Also on:    postgresql.org/message-id/fbee8f47-ce39-8d6d-132d-833134399438@gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ronljohnsonjr@gmail.com
  Subject: Re: Truncation of UNLOGGED tables upon restart.
  In-Reply-To: <fbee8f47-ce39-8d6d-132d-833134399438@gmail.com>
  References: <1951433141.20816140.1541105355093.ref@mail.yahoo.com> <1951433141.20816140.1541105355093@mail.yahoo.com> <CAKFQuwaXNVdT6N75ZbjvO8+wySn=iW5xyc3Ox+faZ=XP_gz3rw@mail.gmail.com> <fbee8f47-ce39-8d6d-132d-833134399438@gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox