LoginSignup
8
7

More than 5 years have passed since last update.

pg_restoreでのリストアを高速化する

Last updated at Posted at 2015-11-25

まず、-Fcオプションを指定して、カスタム形式でバックアップをする。

pg_dump -Fc -U [ユーザ名] -d [db名] -h [IP]  > /tmp/backup.custom

カスタム形式のバックアップをpg_restoreでリストアする。
その際に、jobsオプションを指定することで、restoreを並列処理で実行できるため高速化できる。

pg_restore -v -c --jobs=2 [db名] /tmp/backup.custom -d 

jobsの値はCPUコア数より若干大きい値が良さそう。

8
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
7