pg_dump / psql import
The concrete dump-and-restore path for moving any Postgres database into Silos.
pg_dump and psql are the standard PostgreSQL tools for exporting and importing a
database. Because Silos runs real Postgres and speaks the standard wire protocol, the
dump-and-restore flow you'd use between any two Postgres servers works for importing
into Silos — no Silos-specific tooling required.
Match your client tools to your data. Using pg_dump/psql from a recent PostgreSQL
release avoids version-mismatch surprises when restoring into Silos.
Set up connection strings
You'll work with two connection strings: your source database and your Silos destination.
# Your existing database
export SOURCE_URL="postgres://user:password@source-host:5432/mydb"
# Your Silos database — find it in the Console or via the CLI
export SILOS_URL="postgres://user:password@db-xxxx.silos.sh/main?sslmode=require"Get the Silos connection string from the Console or the CLI:
silos db connection-string my-appPlain SQL dump and restore
The simplest, most portable path is a plain-SQL dump piped (or saved and replayed) into the destination.
Dump the source
pg_dump "$SOURCE_URL" --no-owner --no-privileges -Fp -f dump.sql--no-owner and --no-privileges strip role/ownership and grant statements that
reference roles which may not exist in the destination — the usual cause of restore
errors when moving between platforms.
Restore into Silos
psql "$SILOS_URL" -f dump.sqlOr do it in one pipe without an intermediate file:
pg_dump "$SOURCE_URL" --no-owner --no-privileges | psql "$SILOS_URL"Verify
Spot-check that your tables and row counts came across:
psql "$SILOS_URL" -c "\dt"
psql "$SILOS_URL" -c "SELECT count(*) FROM your_table;"Custom-format dumps
For larger databases, the custom format (-Fc) supports parallel restore and
selective object restore via pg_restore.
# Dump
pg_dump "$SOURCE_URL" --no-owner --no-privileges -Fc -f dump.dump
# Restore
pg_restore --no-owner --no-privileges -d "$SILOS_URL" dump.dumpSchema first, then data
If you'd rather review the schema before loading data — or apply it through
silos silo — dump them separately:
pg_dump "$SOURCE_URL" --schema-only --no-owner -f schema.sql
pg_dump "$SOURCE_URL" --data-only --no-owner -f data.sql
psql "$SILOS_URL" -f schema.sql
psql "$SILOS_URL" -f data.sqlBefore you import
- Check extensions. Make sure any extensions your dump enables are available in the Silos WASM runtime; some heavyweight ones aren't. See Extensions.
- Test on a branch. Restore into a branch or a throwaway database first, validate, then import into the real target.
- Mind TLS. Keep
sslmode=requireon the Silos URL — connections require TLS.
Always validate a restore (schema, row counts, a few real queries) before pointing production traffic at the imported database.