Re: Proposal for unlogged tables - Mailing list pgsql-performance

From Mark Zealey
Subject Re: Proposal for unlogged tables
Date
Msg-id 568AA7F6.5050107@allaroundtheworld.fr
Whole thread Raw
In response to Re: Proposal for unlogged tables  (Andres Freund <andres@anarazel.de>)
Responses Re: Proposal for unlogged tables
List pgsql-performance

On 04/01/16 18:12, Andres Freund wrote:
> Pages containing data of unlogged tables aren't ever flushed to disk
> unless
> a) a shutdown checkpoint is performed
> b) a buffer containing data from an unlogged table is used for something
>     else
> c) the database being copied is the the source of a CREATE DATABASE .. TEMPLATE
>
> Hence, if there's an unclean shutdown, there's absolutely no guarantee
> about the on-disk state of unlogged tables. Even if they haven't been
> modified in ages - there could have been many many dirty pages in shared
> buffers when crashing.
>
>
> Always flushing dirty pages of unlogged tables at checkpoint would
> greatly increase the overhead for memory resident, write heavy workloads
> that use unlogged tables.

If there was a command to flush a specific unlogged table to disk it
would work around all these issues no? Perhaps if you marked the table
as read only at the same time it would flush it to disk and ensure no
more data could be written to it eg (ALTER TABLE ... SET READ ONLY on an
unlogged table would flush + not truncate after crash). In our case this
would be great as we want to use these as permanent tables for speed;
but after an initial data dump we don't change the data again so we
could just do this at the end of the import process.

Mark


pgsql-performance by date:

Previous
From: Andres Freund
Date:
Subject: Re: Proposal for unlogged tables
Next
From: Andres Freund
Date:
Subject: Re: Proposal for unlogged tables