finds.dev

ankane/pgsync

Sync data from one Postgres database to another

View on GitHub

★ 3,475RubyMITupdated Aug 2026

// the take

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.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

search the same ground:

// at a glance

Stars
3,475
Forks
219
Language
Ruby
License
MIT
Last commit
15 Aug 2026

// nearby

If pgsync isn't quite it.

All repos →