From: | Stephen Frost <sfrost(at)snowman(dot)net> |
---|---|
To: | Ravi Krishna <srkrishna1(at)aol(dot)com> |
Cc: | david(dot)g(dot)johnston(at)gmail(dot)com, pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Truncation of UNLOGGED tables upon restart. |
Date: | 2018-11-01 23:06:32 |
Message-ID: | 20181101230632.GK4184@tamriel.snowman.net |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Greetings,
* Ravi Krishna (srkrishna1(at)aol(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Rich Shepard | 2018-11-02 00:08:32 | Re: Add columns to table; insert values based on row |
Previous Message | Rich Shepard | 2018-11-01 21:56:37 | Re: Add columns to table; insert values based on row |