How to Handle Sequences in Logical Bi-Directional Replication

From: PGSQL DBA <pgsqldba(dot)1987(at)gmail(dot)com>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: How to Handle Sequences in Logical Bi-Directional Replication
Date: 2024-06-13 01:23:18
Message-ID: CAKaKWS8guhPRv_x9YtXLk3U4RWotOREAv5CnUff1HAWuLAfrMA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hi Experts,

I am reaching out to seek your guidance and expertise on handling sequences
in a bi-directional logical replication setup.

I am planning to set up two PostgreSQL-16 database servers with logical
bi-directional replication, using the *`origin=none`* configuration. In
this setup, my application will be connecting to either of the database
servers for DML operations.

Given this scenario, I am looking for the best practices to handle sequence
values to ensure consistency and avoid conflicts. Specifically, I would
like to understand:

1. How to configure sequences to avoid duplicate values in both database
servers.
2. Whether there are specific settings or configurations in PostgreSQL that
facilitate the management of sequences in a bi-directional replication
environment.
3. Any recommendations or strategies to ensure smooth and consistent
sequence management across the two servers.

I appreciate any guidance you can provide on this matter.

Thank you!

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Achilleas Mantzios 2024-06-13 03:58:08 Re: Logical replication from PostgreSQL 10.23 to 16.3, last two big tables (getting synced) just keep growing
Previous Message Holger Jakobs 2024-06-12 19:50:52 Re: pg_upgrade