Sync Postgres data between databases. Designed for:
- speed – up to 4x faster than traditional tools on a 4 -core machine
- security – built-in methods to prevent sensitive data from ever leaving the server
- convenience – sync partial tables, groups of tables, and related records
Battle Battle -tested at Instacart
pgsync is a command line tool. To install, run:
This will give you the pgsync command. If installation fails, you may need to install dependencies .
In your project directory, run:
This creates . Pgsync.yml for you to customize. We recommend checking this into your version control (assuming it doesn’t contain sensitive information).
pgsync commands can be run from this directory or any subdirectory.
Sync all tables
Note: pgsync assumes your schema is already set up on your local machine. See the schema section if that’s not the case.
Sync specific tables
Sync specific rows (existing rows are overwritten)
You can also preserve existing rows
pgsync products " where store_id=1--preserve
Or truncate them
pgsync products " where store_id=1- truncate
Exclude Tables To always exclude, add to
. Pgsync.yml .
(exclude) : - table1 - table2 For Rails, you probably want to exclude schema migrations and ActiveRecord metadata.
GIPHY App Key not set. Please check settings