pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Mark Zealey <mark@allaroundtheworld.fr>
Cc: pgsql-performance@postgresql.org
Subject: Re: Proposal for unlogged tables
Date: Mon, 4 Jan 2016 17:12:34 +0100
Message-ID: <20160104161234.GE28025@awork2.anarazel.de> (raw)
In-Reply-To: <568A83F0.7050904@allaroundtheworld.fr>
References: <568A429C.2010507@allaroundtheworld.fr>
	<568A8168.1070900@zioup.com>
	<568A83F0.7050904@allaroundtheworld.fr>
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-performance>

On 2016-01-04 16:38:40 +0200, Mark Zealey wrote:
> I don't know how the internals work but unlogged tables definitely flushed
> to disk and persist through normal server restarts. It is just according to
> the docs if the server ever has an unclean shutdown the tables are truncated
> even if they have not been updated in a year. I can't understand why it has
> to be like this and it seems that it would be much nicer to not
> automatically truncate if it doesn't have to.

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.

Andres


-- 
Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance



view thread (6+ messages)  latest in thread

Message-ID: <20160104161234.GE28025@awork2.anarazel.de>
Permalink:  ../20160104161234.GE28025@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20160104161234.GE28025@awork2.anarazel.de

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: andres@anarazel.de, mark@allaroundtheworld.fr
  Subject: Re: Proposal for unlogged tables
  In-Reply-To: <20160104161234.GE28025@awork2.anarazel.de>

* 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