pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andreas Gaab <A.Gaab@scanlab.de>
Cc: pgsql-sql mailing list <pgsql-sql@postgresql.org>
Cc: Hans Joachim Münzer <H.Muenzer@scanlab.de>
Subject: Re: WAL-files restore and nextval('PK')
Date: Mon, 03 May 2010 09:33:21 -0400
Message-ID: <14002.1272893601@sss.pgh.pa.us> (raw)
In-Reply-To: <48DA836F3865C54B8FBF424A3B775AF6010D455863@Exchange-Server>
References: <48DA836F3865C54B8FBF424A3B775AF6010D455863@Exchange-Server>

Andreas Gaab <A.Gaab@scanlab.de> writes:
> after an WAL-restore of our Postgres DB, we observe seemingly wrong values of our sequences.

> We have two postgres server (8.4) with pgpool in replication mode.

> Recently we tested our restore procedure and played our WAL-files into the second server after an old file-system backup was restored.
> Accidently, we aborted the starting server and had to restart it and therefore started WAL-replay again.

> Now we observe, that the newly restored server has higher values in his sequences as the other server.

It's normal for sequence counters to be a few counts higher after a
crash-and-restart than they would have been if no crash had occurred.
This is an intentional design tradeoff to minimize the WAL overhead
associated with assigning a sequence value.  If you find it intolerable
for what you're doing, I believe you can prevent it by adjusting the
sequence parameters to prevent any "caching" of values.

			regards, tom lane



view thread (3+ messages)  latest in thread

Message-ID: <14002.1272893601@sss.pgh.pa.us>
Permalink:  ../14002.1272893601@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/14002.1272893601@sss.pgh.pa.us

 · 

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-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, A.Gaab@scanlab.de, H.Muenzer@scanlab.de
  Subject: Re: WAL-files restore and nextval('PK')
  In-Reply-To: <14002.1272893601@sss.pgh.pa.us>

* 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