pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephen Frost <sfrost@snowman.net>
To: Ravi Krishna <srkrishna1@aol.com>
Cc: david.g.johnston@gmail.com
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Truncation of UNLOGGED tables upon restart.
Date: Thu, 1 Nov 2018 19:06:32 -0400
Message-ID: <20181101230632.GK4184@tamriel.snowman.net> (raw)
In-Reply-To: <1177060548.6477958.1541107219801@mail.yahoo.com>
References: <1951433141.20816140.1541105355093.ref@mail.yahoo.com>
	<1951433141.20816140.1541105355093@mail.yahoo.com>
	<CAKFQuwaXNVdT6N75ZbjvO8+wySn=iW5xyc3Ox+faZ=XP_gz3rw@mail.gmail.com>
	<1177060548.6477958.1541107219801@mail.yahoo.com>

Greetings,

* Ravi Krishna (srkrishna1@aol.com) wrote:
> > 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.
> 
> I am aware that unlogged tables have no entries in WAL, but I assumed (incorrectly) that PG will at least keep track whether any writes was done on a table since last checkpoint, and if none, it will find no reason to truncate it.

No, we don't currently track that information but it's an interesting
idea, at least imv.

> The use case I was thinking about is that if we have to load a large set of data every weekend and use it for reporting until next weekend, why not create those tables as unlogged.

Seems like a pretty useful use-case.  I had been thinking for a while,
based on a comment made be someone else (Vik Fearing..), that we should
have a way to turn an unlogged table into an 'init table' or similar-
that is, just copy the data from the main fork into the init fork and
then fsync it, then the data is there on restart.

Having a way to say 'this data has been fsyncd' is a pretty interesting
idea though.  I wonder how hard it'd be to make that work.

Thanks!

Stephen

Attachments:

  signature.asc (application/pgp-signature, 818B) download

view thread (7+ messages)  latest in thread

Message-ID: <20181101230632.GK4184@tamriel.snowman.net>
Permalink:  ../20181101230632.GK4184@tamriel.snowman.net/
Also on:    postgresql.org/message-id/20181101230632.GK4184@tamriel.snowman.net

 · 

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: sfrost@snowman.net, srkrishna1@aol.com, david.g.johnston@gmail.com
  Subject: Re: Truncation of UNLOGGED tables upon restart.
  In-Reply-To: <20181101230632.GK4184@tamriel.snowman.net>
  References: <1951433141.20816140.1541105355093.ref@mail.yahoo.com> <1951433141.20816140.1541105355093@mail.yahoo.com> <CAKFQuwaXNVdT6N75ZbjvO8+wySn=iW5xyc3Ox+faZ=XP_gz3rw@mail.gmail.com> <1177060548.6477958.1541107219801@mail.yahoo.com> <20181101230632.GK4184@tamriel.snowman.net>

* 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