Deep-dive on the Next Gen Platform. Join the Webinar!

Skip Navigation
Show nav
Dev Center
  • Get Started
  • Documentation
  • Changelog
  • Search
  • Get Started
    • Node.js
    • Ruby on Rails
    • Ruby
    • Python
    • Java
    • PHP
    • Go
    • Scala
    • Clojure
    • .NET
  • Documentation
  • Changelog
  • More
    Additional Resources
    • Home
    • Elements
    • Products
    • Pricing
    • Careers
    • Help
    • Status
    • Events
    • Podcasts
    • Compliance Center
    Heroku Blog

    Visit the Heroku Blog

    Find news and updates from Heroku in the blog.

    Visit Blog
  • Log inorSign up
Hide categories

Categories

  • Heroku Architecture
    • Compute (Dynos)
      • Dyno Management
      • Dyno Concepts
      • Dyno Behavior
      • Dyno Reference
      • Dyno Troubleshooting
    • Stacks (operating system images)
    • Networking & DNS
    • Platform Policies
    • Platform Principles
  • Developer Tools
    • Command Line
    • Heroku VS Code Extension
  • Deployment
    • Deploying with Git
    • Deploying with Docker
    • Deployment Integrations
  • Continuous Delivery & Integration (Heroku Flow)
    • Continuous Integration
  • Language Support
    • Node.js
      • Working with Node.js
      • Troubleshooting Node.js Apps
      • Node.js Behavior in Heroku
    • Ruby
      • Rails Support
      • Working with Bundler
      • Working with Ruby
      • Ruby Behavior in Heroku
      • Troubleshooting Ruby Apps
    • Python
      • Working with Python
      • Background Jobs in Python
      • Python Behavior in Heroku
      • Working with Django
    • Java
      • Java Behavior in Heroku
      • Working with Java
      • Working with Maven
      • Working with Spring Boot
      • Troubleshooting Java Apps
    • PHP
      • PHP Behavior in Heroku
      • Working with PHP
    • Go
      • Go Dependency Management
    • Scala
    • Clojure
    • .NET
      • Working with .NET
  • Databases & Data Management
    • Heroku Postgres
      • Postgres Basics
      • Postgres Getting Started
      • Postgres Performance
      • Postgres Data Transfer & Preservation
      • Postgres Availability
      • Postgres Special Topics
      • Migrating to Heroku Postgres
    • Heroku Key-Value Store
    • Apache Kafka on Heroku
    • Other Data Stores
  • AI
    • Working with AI
  • Monitoring & Metrics
    • Logging
  • App Performance
  • Add-ons
    • All Add-ons
  • Collaboration
  • Security
    • App Security
    • Identities & Authentication
      • Single Sign-on (SSO)
    • Private Spaces
      • Infrastructure Networking
    • Compliance
  • Heroku Enterprise
    • Enterprise Accounts
    • Enterprise Teams
    • Heroku Connect (Salesforce sync)
      • Heroku Connect Administration
      • Heroku Connect Reference
      • Heroku Connect Troubleshooting
  • Patterns & Best Practices
  • Extending Heroku
    • Platform API
    • App Webhooks
    • Heroku Labs
    • Building Add-ons
      • Add-on Development Tasks
      • Add-on APIs
      • Add-on Guidelines & Requirements
    • Building CLI Plugins
    • Developing Buildpacks
    • Dev Center
  • Accounts & Billing
  • Troubleshooting & Support
  • Integrating with Salesforce
  • Databases & Data Management
  • Heroku Postgres
  • Postgres Basics
  • Forking Your Heroku Postgres Database

Forking Your Heroku Postgres Database

English — 日本語に切り替える

Last updated July 26, 2024

Table of Contents

  • Use Cases
  • Create a Fork
  • Fork Fast Option
  • Delete a Fork

Forking creates a new database containing a snapshot of an existing database at the current point in time. Unlike follower databases, forks don’t stay up to date with the parent database and you can write to them. Forks don’t affect the performance of the parent database.

Forking is only supported on Standard-tier or higher database plans. Follow these steps to upgrade from an Essential-tier database to a plan in a higher tier.

Use Cases

Forks don’t affect the performance of the parent database.

Forked databases provide a risk-free way of working with your production data and schema. For example, you can use them to test new schema migrations or to load test your application on a different database plan. They’re also valuable as snapshots of your data at a particular point in time for later analysis or forensics.

Create a Fork

You can create forks on any Standard, Premium, Private, or Shield database that isn’t a follower.

You can’t create forks from another newly forked database for a short period of time. This limitation applies both to forks created by the methods described in this article and to forks created through unfollow. Use the pg:info command to check if Fork/Follow is Available.

Forks don’t have to be on the same database plan as the parent database. Forks can be on any plan but must have enough disk space to contain the data from the parent database.

Preparing a fork can take anywhere from several minutes to several hours, depending on the size of your dataset.

After forking a database, the app the fork is attached to updates with a new HEROKU_POSTGRESQL_COLOR_URL config var. This config var update restarts the app.

Create Using the CLI

You can create forks using the Heroku CLI with the heroku addons:create command. Provision a new database add-on with the --fork flag. Supply the flag with one of the following:

  • The config var name of the database on the same app
  • The name of the database add-on
  • The full URL of any Heroku Postgres database
  • An argument in the form of appname::HEROKU_POSTGRESQL_COLOR_URL. This allows you to create a fork of a database that is attached to another app.

The addons:create example follows the syntax for Heroku CLI v9.0.0 or later. If you’re on v8.11.5 or earlier, use the command:

$ heroku addons:create heroku-postgresql:standard-0 --fork HEROKU_POSTGRESQL_CHARCOAL_URL --app example-app
$ heroku addons:create heroku-postgresql:standard-0 --app example-app -- --fork HEROKU_POSTGRESQL_CHARCOAL_URL
Adding heroku-postgresql:standard-0 on example-app... done, v71 ($50/mo)
Attached as HEROKU_POSTGRESQL_SILVER_URL
Database will become available after it completes forking
Use `heroku pg:wait` to track status

The heroku pg:wait command outputs the provisioning status of any new databases. Use it to determine when the fork is up to date.

$ heroku pg:wait --app example-app
Waiting for database HEROKU_POSTGRESQL_SILVER_URL... available

Create Using the Heroku Data Dashboard

You can also create forks through the web dashboard:

  1. Go to data.heroku.com.
  2. Use the search and select the database you want to create a fork from.
  3. Click the Settings tab.
  4. Click Fork Database....
  5. Choose the plan for the fork. Review the Create a Fork section for notes on selecting a plan size.
  6. Click Fork Database.

The dashboard shows the status of the forked database and updates when the provisioning is complete.

Fork Fast Option

Fast forks can be up to 30 hours out-of-date.

You can create forks faster via the CLI with the --fast flag. This option is useful if no major changes, such as schema migrations or large data imports, occurred in your database in the last 30 hours.

The addons:create example follows the syntax for Heroku CLI v9.0.0 or later. If you’re on v8.11.5 or earlier, use the command:

$ heroku addons:create heroku-postgresql:standard-4 --fork HEROKU_POSTGRESQL_CHARCOAL --fast --app example-app
$ heroku addons:create heroku-postgresql:standard-4 --app example-app -- --fork HEROKU_POSTGRESQL_CHARCOAL --fast

Adding heroku-postgresql:standard-4 on dashboard... done, v1022 ($1200/mo)
Attached as HEROKU_POSTGRESQL_BLUE_URL

Fork will contain data from 5/26/2021 at 13:56 UTC (about 16 hours old)
To create a fork with up-to-date data, exclude the `--fast` flag.

Database will become available after it completes forking
Use `heroku pg:wait` to track status.
Use `heroku addons:docs heroku-postgresql` to view documentation

Delete a Fork

Delete Using the CLI

Deprovision a fork using heroku addons:destroy:

Be sure to remove the _URL suffix from the database name in this command.

$ heroku addons:destroy HEROKU_POSTGRESQL_SILVER --app example-app

!    WARNING: Destructive Action
!    This command will affect the app: example-app
!    To proceed, type "example-app" or re-run this command with --confirm example-app

Delete Using the Heroku Data Dashboard

  1. Go to data.heroku.com.
  2. Use the search and select the fork database you want to delete.
  3. Click the Settings tab.
  4. Click Delete Database....
  5. Type in the name of your app to confirm.
  6. Click Delete Database.

Keep reading

  • Postgres Basics

Feedback

Log in to submit feedback.

Upgrading the Version of a Heroku Postgres Database Heroku PGSettings

Information & Support

  • Getting Started
  • Documentation
  • Changelog
  • Compliance Center
  • Training & Education
  • Blog
  • Support Channels
  • Status

Language Reference

  • Node.js
  • Ruby
  • Java
  • PHP
  • Python
  • Go
  • Scala
  • Clojure
  • .NET

Other Resources

  • Careers
  • Elements
  • Products
  • Pricing
  • RSS
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku Blog
    • Heroku News Blog
    • Heroku Engineering Blog
  • Twitter
    • Dev Center Articles
    • Dev Center Changelog
    • Heroku
    • Heroku Status
  • Github
  • LinkedIn
  • © 2025 Salesforce, Inc. All rights reserved. Various trademarks held by their respective owners. Salesforce Tower, 415 Mission Street, 3rd Floor, San Francisco, CA 94105, United States
  • heroku.com
  • Legal
  • Terms of Service
  • Privacy Information
  • Responsible Disclosure
  • Trust
  • Contact
  • Cookie Preferences
  • Your Privacy Choices