Copy PostgreSQL production database to a new Railway Postgres instance for testing
horaciolampe
PROOP

3 months ago

Hello Railway Support,

I have a PostgreSQL database in production and I need to test a merge with new functionalities before making any changes to production.

For that, I would like to create a copy of the current production database — including all data, schema, constraints, indexes, and relationships — into a new PostgreSQL instance in another workspace/environment, so I can safely run integration and merge tests there first.

The database size is approximately 500 MB.

Could you please confirm:

  1. Whether Railway supports cloning or copying a PostgreSQL database of this size into a new Postgres instance.
  2. What is the recommended way to do it inside Railway.
  3. Whether the copy can preserve the full schema, constraints, indexes, and data exactly as in production.
  4. Whether there is any built-in tool, template, snapshot, backup restore, or migration workflow you recommend for this case.
  5. Whether there are any limitations when copying between different workspaces or projects.

My goal is to create a safe testing environment identical to production before applying the merge.

Thank you in advance.

Best regards,

Horacio Lampe

Solved

1 Replies

sam-a
EMPLOYEE

3 months ago

The recommended way to copy a PostgreSQL database between Railway instances is using the standard pg_dump / pg_restore workflow. Spin up a new Postgres service in your target project or environment, then use pg_dump to export from your production instance via its TCP proxy connection string, and pg_restore to import into the new one. This preserves the full schema, constraints, indexes, and data. A 500 MB database is well within normal range for this approach. There are no limitations copying between different workspaces or projects since you are connecting externally via TCP proxy on both ends. We have a detailed walkthrough here: Migrating PostgreSQL Data Between Services.


Status changed to Awaiting User Response Railway 3 months ago


Railway
BOT

2 months ago

This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!

Status changed to Solved Railway 2 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...