Parallel dump and restore

Custom-format parallel dump/restore; note: -j needs directory or custom format, not plain SQL

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>

    Run 60s load test with 32 clients across 8 threads, progress every 5s

  • psql -h localhost -U myuser -d mydb

    Interactive psql session to a database

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

    Show all databases with 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;'

    Show query plan with actual timings and buffer usage

all 29 postgres commands