First:

pg_dumpall > outfile

then:
psql -U "owner name" dbname < infile
(or: psql -f infile postgres)

Once restored, it is wise to run ANALYZE on each database so the optimizer has useful statistics. An easy way to do this is to run:

"vacuumdb -U 'owner name' -a -z"

to VACUUM ANALYZE all databases; this is equivalent to running VACUUM ANALYZE manually.

  • Share/Bookmark