Re: Streaming replication: sequences on slave seemingly ahead of sequences on master

From: Simon Riggs <simon(at)2ndQuadrant(dot)com>
To: Vincent de Phily <vincent(dot)dephily(at)mobile-devices(dot)fr>
Cc: pgsql-general(at)postgresql(dot)org, benjamin(dot)vialle(at)mobile-devices(dot)fr
Subject: Re: Streaming replication: sequences on slave seemingly ahead of sequences on master
Date: 2012-05-06 09:29:17
Message-ID: CA+U5nMLrdpv2oAY6+V0nCugwfFg+XFucdk1OZGZOgViCb3+kKg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4 May 2012 14:55, Vincent de Phily <vincent(dot)dephily(at)mobile-devices(dot)fr> wrote:

> It all seems to be working fine, except that when checking the data (selecting
> latest primary key and sequence value for all tables) on master and slave,
> some sequence ids are higher on the slave than on the master. I could
> understand if they were lower, but this is weird.
>
> * The slave's sequences can be anywhere between 1 and 50 ids ahead.

This is normal. The sequences are advanced in chunks of 100, so the
master's value will be the nextval() while the value on standby will
be the start of the next chunk, so as you say, slightly ahead of the
master.

The same thing would also happen in case of a crash.

--
 Simon Riggs                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Aleksey Tsalolikhin 2012-05-06 17:24:53 how to amend SQL standard to add comments?
Previous Message Stefan Tzeggai 2012-05-05 21:19:14 Lost one tablespace - can't access whole database