// the find
ankane/pgsync
Sync data from one Postgres database to another
pgsync is a Ruby CLI for copying data between two Postgres databases, built by ankane (also behind PgHero, Dexter, pgslice) and battle-tested at Instacart. It's aimed at teams who need to pull slices of production data into staging/dev without a full pg_dump/restore, with built-in anonymization for sensitive columns.
The data_rules system for anonymizing columns (unique_email, random_date, statement:, etc.) on the way out is the standout feature — most sync tools don't think about this until after a leak. Tables sync in parallel via --jobs, and the groups/variables feature (pgsync product:123) lets you pull a record plus its FK graph in one shot, which is genuinely useful for reproducing a specific bug locally. FK handling gives you three honest tradeoffs (defer constraints, manual ordering, or disable triggers) instead of pretending there's one right answer.
Destination safety is a single boolean (to_safe: true) away from disabled, and --disable-integrity can silently break referential integrity with no automated check afterward — both are documented but still foot-guns. --in-batches only works on tables with a numeric, increasing primary key, so it's dead on arrival for UUID PKs, which is most Rails/Postgres apps built in the last several years. It's a Ruby gem with a native libpq dependency, so adopting it in a non-Ruby shop means carrying a Ruby toolchain just for this one tool. SSL/transport security is entirely on the user to configure (sslmode=verify-full) — the tool does nothing to enforce or even warn at runtime if you're syncing over an insecure connection.