pgcopydb - Database Copy Tool

Copy PostgreSQL Databases with Minimal Downtime

pgcopydb copies a PostgreSQL database to a target server. It uses logical replication for live copies and supports large databases with minimal downtime.

Overview

pgcopydb is a tool that helps you copy a PostgreSQL database from one server to another. Unlike simple pg_dump/pg_restore, pgcopydb is designed for production use with features like live replication and incremental copy.

Key Features

  • Live database cloning: Copy data while the source database is online
  • Logical replication: Uses PostgreSQL's logical replication for efficiency
  • Minimal downtime: Only a short maintenance window needed
  • Large database support: Handles databases of any size
  • Table filtering: Copy only specific tables or schemas

Use Cases

  • Database migration to a new server
  • Creating read replicas
  • Database cloning for testing
  • Upgrading to a new PostgreSQL version
  • Moving to cloud PostgreSQL

Installation

# From source
git clone https://github.com/dimitri/pgcopydb.git
cd pgcopydb
make

pgcopydb is also available as a Docker image:

docker pull dimitri/pgcopydb

Quick Example

pgcopydb copy --source "postgres://source:5432/db" --target "postgres://target:5432/db"

Support Options

Get professional support and maintenance for pgcopydb in your production environment.