a month ago
Hello,
I’m trying to restore a PostgreSQL custom-format dump into a Railway Postgres database, but pg_restore repeatedly hangs while streaming data through the public proxy.
Environment: staging
Project/service context:
- Target: Postgres database
- Connection path: public proxy,
centerbeam.proxy.rlwy.net:50330 - Client: local macOS terminal
- Restore command shape:
pg_restore --verbose --no-owner --no-acl \
--dbname "$TARGET_STAGING_DATABASE_URL" \
production.dump
Earlier attempts also used:
pg_restore --verbose --clean --if-exists --no-owner --no-acl \
--dbname "$TARGET_STAGING_DATABASE_URL" \
production.dump
What happens:
- The restore starts, but eventually stops making progress.
- From
pg_stat_activity, the restore backend sits onClientRead, waiting for the client. - Example:
pid | application_name | state | wait_event_type | wait_event | duration | query
3875 | pg_restore | active | Client | ClientRead | 00:04:23 | COPY public.leagues_masterplayer (...) FROM stdin;
pg_stat_progress_copystops changing:
pid | table_name | command | type | bytes_processed | bytes_total | tuples_processed
3875 | leagues_masterplayer | COPY FROM | PIPE | 103521 | 0 | 643
- Running the progress query again later shows the exact same
bytes_processedandtuples_processed. - Locally, the
pg_restoreprocess remains alive but shows essentially no CPU activity.
It does not hang after a long-running restore. It usually hangs very quickly — sometimes within a minute or less. In the latest attempt, it stalled during COPY on public.leagues_masterplayer after only 643 tuples / 103,521 bytes processed.
This has happened multiple times. Earlier attempts also left idle restore sessions like:
pg_restore | idle | Client | ClientRead | DROP INDEX IF EXISTS ...
pg_restore | idle | Client | ClientRead | CREATE INDEX ...
What I’ve tried:
- Killed the local
pg_restoreprocess. - Terminated stale
pg_restorebackends withpg_terminate_backend. - Retried without
--clean. - Wiped the target schema manually first using:
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
- Verified from Postgres that it is not blocked on locks; the server appears to be waiting for the client stream.
An issue related to Railway public TCP proxy?
Is there a recommended way to run pg_restore from inside Railway, or to use an internal/private database URL instead of the public proxy?
Thanks!
0 Replies
Status changed to Awaiting User Response Railway • 26 days ago
a month ago
This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.
Status changed to Open Railway • 26 days ago
Status changed to Solved mstrchng • 25 days ago