It’s exciting to share that pg_easy_replicate
, a project I’ve been maintaining, has hit a new milestone with its 2.0 release! This tool is more than a practical solution for setting up logical replication between PostgreSQL databases—it’s been a profound source of learning about PostgreSQL concepts for me. Engaging with the community and discovering the ways they use pg_easy_replicate
has been equally satisfying, making this journey an enjoyable and insightful experience.
What is pg_easy_replicate
?
At its core, pg_easy_replicate
is a CLI orchestrator tool that makes the process of setting up and managing logical replication between PostgreSQL databases a breeze. It’s designed to ensure zero data loss and minimal downtime, making operations like major version upgrades, load testing with blue/green database setups, and other similar tasks more manageable.
https://github.com/shayonj/pg_easy_replicate
The Journey to 2.0
The journey to 2.0 has been an exciting one. One of the most awaited features I’ve been eager to introduce is the support for recreating indices post COPY, and it’s finally here in 2.0! This feature was on my mind since the inception of the project, but I just never got around to it. Here’s how it works:
- Once all tables are ready for replication,
pg_easy_replicate
drops the indices from the target database and kicks off the subscription. - During the switchover, it ensures all tables are replicating. Then, it re-adds the indices (
CONCURRENTLY
), significantly reducing the I/O and time required to fully copy a table from the source database. This is particularly beneficial for large databases where efficiency is key.
Other Notable Enhancements in the Past Year
The past year has been a whirlwind of activity and improvement for pg_easy_replicate
:
- Introduction of
--copy_schema
viapg_dump
: This feature simplifies the replication process by eliminating the need for additional steps. Now, you can start replication without worrying about tertiary processes. - Community Contributions: Bug fixes and reports from the community have been invaluable. They’ve helped tackle some peculiar edge cases and improve the tool’s robustness.
- New Contributors: The project has welcomed 4 new contributors, which was quite exciting.
- Support for AWS and GCP: There is now support for special user scenarios on these platforms and added a
--special-user-role
option to accommodate various configurations.
If you’d like to learn more about the tool and how it works, checkout the README
at: https://github.com/shayonj/pg_easy_replicate