[Bucardo-general] PostgreSQL/Bucardo Sequences

Greg Sabino Mullane greg at endpoint.com
Sun Nov 9 15:47:12 UTC 2014


On Sun, Nov 09, 2014 at 04:40:28PM +0100, Michelle Sullivan wrote:
> server1> ALTER SEQUENCE myseq INCREMENT BY 3 START WITH 1;
> server2> ALTER SEQUENCE myseq INCREMENT BY 3 START WITH 2;
> server3> ALTER SEQUENCE myseq INCREMENT BY 3 START WITH 3;

In the case of already used tables, you will want to see where the 
sequences already are:

SELECT last_value FROM myseq; (repeat for the others tables).

Then choose a large, even number safely above all the existing values 
and do SQL similar to the above, but using RESTART. So if your current 
sequences are at 16341 and 16992 and 17012, you might do:

server1> ALTER SEQUENCE myseq INCREMENT BY 3 RESTART WITH 18000;
server2> ALTER SEQUENCE myseq INCREMENT BY 3 RESTART WITH 18001;
server3> ALTER SEQUENCE myseq INCREMENT BY 3 RESTART WITH 18002;

-- 
Greg Sabino Mullane greg at endpoint.com
End Point Corporation
PGP Key: 0x14964AC8
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: Digital signature
URL: <https://mail.endcrypt.com/pipermail/bucardo-general/attachments/20141109/b1ed4006/attachment.sig>


More information about the Bucardo-general mailing list