Re: Replication sequence

From: Loles <lolesft(at)gmail(dot)com>
To: Paolo Saudin <paolosaudin(at)gmail(dot)com>
Cc: PostgreSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Replication sequence
Date: 2021-02-15 19:40:41
Message-ID: CA+FWGK5wb2iG9VLx2FL81Ym-k3t0LZUAsADAuOoiGGnCJnaL+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

One thing is the number of records in the table and another is the current
value of the sequence.

Execute:

select max (field) from bobo.menu_pages;

In both master and slave server.

What give you back?

"field" is the data that belongs to the sequence.

El lun., 15 feb. 2021 18:55, Paolo Saudin <paolosaudin(at)gmail(dot)com> escribió:

> Hi all,
> I have two servers, a primary and a secondary one with a streaming replica
> setup.
> Today I noticed that some sequences are not lined-up, the replica ones are
> well ahead, while the records number is the same. How is it possible?
>
> Thanks,
> Paolo
>
> --
> -- primary server
> --
> postgres(at)db-srv1:~$ psql
> psql (9.5.19)
> cf-db-srv1:5432 postgres(at)rete_llpp=# SELECT last_value FROM
> bobo.menu_pages_mp_id_seq;
> ┌────────────┐
> │ last_value │
> ├────────────┤
> │ 74 │
> └────────────┘
> cf-db-srv1:5432 postgres(at)rete_llpp=# select count(*) from
> bobo.menu_pages;
> ┌───────┐
> │ count │
> ├───────┤
> │ 74 │
> └───────┘
>
> --
> -- replica server
> --
> postgres(at)db-srv2:~$ psql
> psql (9.5.24)
> cf-db-srv2:5433 postgres(at)rete_llpp=# SELECT last_value FROM
> bobo.menu_pages_mp_id_seq;
> ┌────────────┐
> │ last_value │
> ├────────────┤
> │ 105 │
> └────────────┘
> cf-db-srv2:5433 postgres(at)rete_llpp=# select count(*) from bobo.menu_pages;
> ┌───────┐
> │ count │
> ├───────┤
> │ 74 │
> └───────┘
>
>

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2021-02-15 19:47:11 Re: Insert into on conflict, data size upto 3 billion records
Previous Message Karthik K 2021-02-15 19:22:44 Re: Insert into on conflict, data size upto 3 billion records