There's more...

Remember how we defined the replication set to only forward INSERT and UPDATE statements? The primary reason to do something like this is because we're sending data to some kind of archival system. Since these types of databases tend to accumulate data for months or even years, they're also commonly partitioned. The pglogical extension is perfectly compatible with this approach, but there is one caveat.

Most, if not all major PostgreSQL partitioning systems use triggers to redirect incoming data to the appropriate partition. To ensure data gets where we need it to go, we need to modify that trigger slightly so it's compatible with pglogical. For example, if our trigger is named pgbench_accounts_part_trig, we'd need to execute ...

Get PostgreSQL High Availability Cookbook - Second Edition 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.