Database:postgres
This is an old revision of the document!
Table of Contents
Drop database & close connections
drop database [db] WITH (force)
Dump local database to file
PGDATABASE=mydb pg_dump -Fc -Z 9 -d $PGDATABASE -U $POSTGRES_USER > /tmp/$PGDATABASE.dump
Import dump file in existing local database
PGDATABASE=mydb POSTGRES_USER=postgres pg_restore --clean -Fc -j 8 -d $PGDATABASE -U $POSTGRES_USER /tmp/db.sql
Run postgresqltuner script in alpine docker image
apk add perl perl-dbd-pg && wget -O /tmp/postgresqltuner.pl https://postgresqltuner.pl && chmod +x /tmp/postgresqltuner.pl && /tmp/postgresqltuner.pl