A faster way to copy a postgresql database (or the best way)

后端 未结 4 1376
礼貌的吻别
礼貌的吻别 2021-01-29 22:12

I did a pg_dump of a database and am now trying to install the resulting .sql file on to another server.

I\'m using the following command.

psql -f databa         


        
4条回答
  •  逝去的感伤
    2021-01-29 22:49

    Improve pg dump&restore

    PG_DUMP | always use format directory with -j option

    time pg_dump -j 8 -Fd -f /tmp/newout.dir fsdcm_external
    

    PG_RESTORE | always use tuning for postgres.conf with format directory With -j option

    work_mem = 32MB
    shared_buffers = 4GB
    maintenance_work_mem = 2GB
    full_page_writes = off
    autovacuum = off
    wal_buffers = -1
    
    time pg_restore -j 8 --format=d -C -d postgres /tmp/newout.dir/`
    

    For more info

    https://gitlab.com/yanar/Tuning/wikis/improve-pg-dump&restore

提交回复
热议问题