From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Stephen Frost <sfrost(at)snowman(dot)net> |
Cc: | Ravi Krishna <srkrishna1(at)aol(dot)com>, 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-02 00:17:58 |
Message-ID: | 20181102001758.GN1727@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Nov 01, 2018 at 07:06:32PM -0400, Stephen Frost wrote:
> No, we don't currently track that information but it's an interesting
> idea, at least imv.
What would be the use case for it? What you are looking for here is
gathering information about all pages in a relation and just aggregate
which one has the newest LSN, which you can do at SQL level using
pageinspect to grab all the page LSNs, then use pg_control_checkpoint()
with the LSN of the last checkpoint to know if a table has been written
as such. I agree that there could be cheaper solutions than that, but
it is hard if the use cases in need of such a thing balance with the
extra maintenance involved by a new feature when there are already tools
allowing one to do that.
> 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.
That's interesting. We already have all the facilities to be able to
handle properly init forks, and the code code better in making sure that
WAL-logging of init forks happens when it should.
> 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.
That's however not much different from a "CREATE TABLE save_data AS
SELECT * FROM unlogged_table" happening at some point in time?
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Stephen Frost | 2018-11-02 00:52:23 | Re: Truncation of UNLOGGED tables upon restart. |
Previous Message | Rich Shepard | 2018-11-02 00:08:32 | Re: Add columns to table; insert values based on row |