---
title: "How we migrate TBs from Heroku without logical replication"
description: "PlanetScale's open-source Heroku Migrator moves multi-terabyte Postgres databases off Heroku standard plans, which lack WAL access and logical replication, by using Bucardo trigger-based replication: triggers record changes in delta tables, a one-time COPY loads existing data, and a worker replays the backlog before a controlled switchover with verification."
url: "https://swe.quest/articles/how-we-migrate-tbs-from-heroku-without-logical-replication-e0568c616a878849"
canonical: "https://planetscale.com/blog/migrate-from-heroku-to-planetscale"
source: "PlanetScale"
published: "2026-11-11"
difficulty: "medium"
kind: "Case study"
reading_minutes: 12
tags: ["postgres","schema-migrations","replication","networking"]
---

# How we migrate TBs from Heroku without logical replication

A post on [PlanetScale](https://swe.quest/sources/planetscale.md), published 2026-11-11, 12 min read, Case study. Original: [https://planetscale.com/blog/migrate-from-heroku-to-planetscale](https://planetscale.com/blog/migrate-from-heroku-to-planetscale)

## Summary

PlanetScale's open-source Heroku Migrator moves multi-terabyte Postgres databases off Heroku standard plans, which lack WAL access and logical replication, by using Bucardo trigger-based replication: triggers record changes in delta tables, a one-time COPY loads existing data, and a worker replays the backlog before a controlled switchover with verification. Version 2.0 fixes failures seen on large migrations. Bucardo's single-transaction initial copy restarted from zero after any interruption, so the migrator now drops secondary indexes before the copy and rebuilds them in parallel afterwards, raising throughput from about 60 to nearly 300 GB/h. It also disables transaction\_timeout on Bucardo's connections, sets TCP keepalives so silently dropped long-lived connections fail within about a minute, and tunes host TCP buffers. A discovery CLI and the Liftoff assessment flag tables without primary keys, incompatible extensions and sizing before the migration starts.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [PostgreSQL](https://swe.quest/tags/postgres.md) (Data & databases)
- [Schema migrations](https://swe.quest/tags/schema-migrations.md) (Data & databases)
- [Replication](https://swe.quest/tags/replication.md) (Distributed systems)
- [Networking](https://swe.quest/tags/networking.md) (Infrastructure)

## Prerequisites

- PostgreSQL administration ([easy posts on PostgreSQL](https://swe.quest/tags/postgres.md?difficulty=easy))
- logical replication basics ([easy posts on Replication](https://swe.quest/tags/replication.md?difficulty=easy))
- database triggers ([easy posts on Databases](https://swe.quest/tags/databases.md?difficulty=easy))
- TCP keepalives ([easy posts on Networking](https://swe.quest/tags/networking.md?difficulty=easy))

## Keywords

PlanetScale, Heroku Postgres, Bucardo, pg\_dump, libpq, Liftoff, ps-discovery

## Related posts

- [The growing pains of database architecture](https://swe.quest/articles/the-growing-pains-of-database-architecture-9202c659b7981acc.md): Figma · 2023-04-04 · Medium · 12 min read · PostgreSQL, Schema migrations, Scaling, Replication, Databases
  Facing ~3x annual database traffic growth and 65% peak CPU on a single Amazon RDS Postgres instance, Figma chose vertical partitioning (moving groups of tables to their own databases) over horizontal sharding, NewSQL, or self-hosting.
- [Making large Postgres migrations practical: 1TB in 2 hours with PeerDB](https://swe.quest/articles/making-large-postgres-migrations-practical-1tb-in-2-hours-with-peerdb-cc7872fe91229eda.md): ClickHouse · 2026-02-19 · Medium · 13 min read · PostgreSQL, Replication, Schema migrations, Performance engineering, Data pipelines
  PeerDB migrated a 1TB, 3.6-billion-row Postgres table in about 1 hour 50 minutes with 8 threads, compared with 8 hours 40 minutes for native logical replication and 17 hours for pg\_dump/pg\_restore.
- [Breaking up a monolith: How we’re unwinding a shared database at scale](https://swe.quest/articles/breaking-up-a-monolith-how-we-re-unwinding-a-shared-database-at-scale-4f34dacf50e040a9.md): Datadog Engineering · 2025-06-17 · Medium · 20 min read · PostgreSQL, Schema migrations, Refactoring & migrations, Microservices, Replication
  Datadog is splitting its large shared Postgres database into independently owned instances through a three-phase plan: logical separation into per-domain private schemas with explicit ACLs, access reduction so only owning teams query their tables directly, and physical separation onto managed OrgStore instances.
- [Leveraging Change Data Capture For Database Migrations At Scale](https://swe.quest/articles/leveraging-change-data-capture-for-database-migrations-at-scale-c10095cde295b15f.md): Squarespace Engineering · 2025-05-13 · Medium · 6 min read · Schema migrations, Event-driven architecture, PostgreSQL, Distributed databases, Stream processing
  Squarespace migrated many PostgreSQL databases to CockroachDB without write downtime by streaming changes through a CDC pipeline: pgoutput logical decoding feeds per-table Debezium connectors into Kafka (Avro), and per-table Apache Beam pipelines on Dataflow upsert batched events into CRDB with checkpointing and backpressure.
- [How we migrated Clera’s 500 GB production database to ClickHouse Managed Postgres overnight](https://swe.quest/articles/how-we-migrated-clera-s-500-gb-production-database-to-clickhouse-managed-f4ed327a88d71cd7.md): ClickHouse · 2026-10-08 · Medium · 8 min read · PostgreSQL, Databases, Performance engineering, Schema migrations, Storage systems
  Clera moved a 500 GB, 500+ table production Postgres database from the EU to the US overnight onto ClickHouse Managed Postgres, with production traffic still running, using two parallel ClickPipes pipelines.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
