Dump and restore in parallel

Dump and restore in 4 parallel jobs; note: pg_restore -j works with custom format, but pg_dump -j needs directory format (-Fd)

pg_dump -Fc -j 4 -d <name> -f db.dump && pg_restore -j 4 -d <name> db.dump

tool
postgres29 commands
tags
postgresperformancedisktroubleshooting

More postgres commands

  • pgbench -c 32 -j 8 -T 60 -P 5 -d <name>; -- init once: pgbench -i -s 100 <name>

    60-second load test with 32 clients on 8 threads and a progress report every 5s

  • psql -h localhost -U myuser -d mydb

    Open an interactive psql session to mydb on localhost

  • psql -U postgres -c '\l+'

    Show all databases with their size and encoding

  • psql -U myuser -d mydb -c '\dt public.*'

    List all tables in the public schema

  • psql -U myuser -d mydb -c 'EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT * FROM orders WHERE status = $1;'

    Run the query and show its plan with real timings and buffer usage

all 29 postgres commands