← Back to team overview

dhis2-devs-core team mailing list archive

faster pg_dump and pg_restore

 

Hi,

just wanted to share a tip on how to dump and restore postgres databases
using the "directory" format which allows for parallel jobs - much faster
on multi-core machines:

*dhis2db = db name*
*dhis = db user*
*dbdump = demo database output name*
*-j 4 = 4 parallel jobs*
*-Fd = directory format*

*Dump:*

pg_dump *dhis2db* -Fd -U dhis -T analytics* -j 4 -f *dbdump*

*Restore:*

pg_restore -d *dhis2db* -U dhis -j 4 *dbdump*


-- 
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
http://www.dhis2.org <https://www.dhis2.org>

Follow ups