How it works...

There are several considerations we should make when evaluating multi-master PostgreSQL, but these are some of the most important. These are decisions we must make or changes that must be incorporated into the application itself before it is safe for distribution across multiple nodes.

We begin with an obvious one: incremental fields. If we rely on sequences and have two nodes, then there's potential for conflict if the nodes do not account for this. Say that Node A assigns ID 5 to a new row, and Node B does the same; this would result in one row being lost. One way of preventing this is to integrate the node number into the sequence and skip increments. So Node A could assign ID 5, 15, 25, and so on, while Node B uses 6, ...

Get PostgreSQL 12 High Availability Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.