Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sequence data and logical replication

From my understanding logical replication in Postgres does not replicate sequence data. Let's assume we have two multi-master postgres servers

server1
test_table
current sequence 100

server2
test_table
current sequence 90

If server1 goes down and server2 will take over for the writes, what would happen when it tries to insert a row with sequence of 90? Since server1 has already inserted a row that has an id of 90. What are some workarounds for this?

like image 994
Arya Avatar asked Feb 01 '26 13:02

Arya


1 Answers

setup the two sequences so that they do not clash.

eg use INCREMENT BY 2 on both sequences and have server 1 give odd numbers and server 2 give even numbers.

like image 94
Jasen Avatar answered Feb 04 '26 07:02

Jasen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!