Site Tools


This is an old revision of the document!


PostgreSQL/Postgres

Backup
pg_dump -h localhost -U postgres -F c -f "~/dbbackup/" dbname
Restore
pg_restore -h localhost -U postgres -d old_db "~/dbbackup/"
Drop index
echo "DROP INDEX mdl_quiz_xxx_idx" | sudo psql -U postgres moodle_19
Handle large db

backup

pg_dump dbname | gzip > filename.gz

restore

gunzip -c filename.gz | psql dbname
cat filename.gz | gunzip | psql dbname
postgresql/start.1587285307.txt.gz · Last modified: by 127.0.0.1