Moving a large Postgres DB
azkalot1
PROOP

4 months ago

I am trying to restore my fairly large postgres DB as

pg_restore -h {url} -p {port} -U postgres -d {db} --no-owner --no-privileges --disable-triggers -j 1 db.dump

using deployed docker container (need some custom stuff for postgres)

It seems like it is hitting RAM limit on the instance, just by looking at metrics.u0219122549_image.pngattached volume is fine

error i get is

db_user pg_restore: error: could not execute query: ERROR: could not resize shared memory segment "/PostgreSQL.3405242480" to 16777216 bytes: No space left on device Command was: REFRESH MATERIALIZED VIEW public.rag_study_keys;

Any suggestions, how to move my DB?

Attachments

Solved

2 Replies

sam-a
EMPLOYEE

4 months ago

Hey! The error you're seeing is a shared memory (SHM) limit issue, not a disk space issue. Railway defaults to 64MB of SHM, which isn't enough for heavy operations like refreshing materialized views during a restore.

To fix this, add the `RAILWAY_SHM_SIZE_BYTES` environment variable to your Postgres service and set it to something like `524288000` (500MB). If that's still not enough, you can bump it higher (e.g. `1073741824` for 1GB). Redeploy after setting it, then retry your `pg_restore`.

Let us know if you need more help.


Status changed to Awaiting User Response Railway 4 months ago


Status changed to Solved sam-a 4 months ago


sam-a

Hey! The error you're seeing is a shared memory (SHM) limit issue, not a disk space issue. Railway defaults to 64MB of SHM, which isn't enough for heavy operations like refreshing materialized views during a restore. To fix this, add the \`RAILWAY\_SHM\_SIZE\_BYTES\` environment variable to your Postgres service and set it to something like \`524288000\` (500MB). If that's still not enough, you can bump it higher (e.g. \`1073741824\` for 1GB). Redeploy after setting it, then retry your \`pg\_restore\`. Let us know if you need more help.

azkalot1
PROOP

4 months ago

that's solved it, thank you!


Status changed to Awaiting Railway Response Railway 4 months ago


Status changed to Solved sam-a 4 months ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...