1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

postgresqlのバイナリ形式のダンプをrsyncで転送するときzはつけないほうがよさそう

Last updated at Posted at 2025-05-14

結論

postgresqlのバイナリ形式のダンプをrsyncで転送するときzはつけないほうがよさそう

前提

pg_dump -Fcでバイナリ形式のダンプを取得していて、これを別サーバーに転送したい

実験してみた

1.4GBくらい(1400914179 byte)のダンプが丁度あったので試した。余談だが、7zで圧縮すると1.3GB程度(1344790818 byte)に縮んだ。

zあり

$ rsync -auhvz --progress <server>:/path/to/backup.dump .
receiving incremental file list
backup.dump
          1.40G 100%   12.67MB/s    0:01:45 (xfr#1, to-chk=0/1)

sent 43 bytes  received 1.40G bytes  12.67M bytes/sec
total size is 1.40G  speedup is 1.00

転送中にhtopでCPU使用率を見ていたが、どうもシングルコアで圧縮してそうだった。

zなし

$ rsync -auhv --progress <server>:/path/to/backup.dump .
receiving incremental file list
backup.dump
          1.40G 100%   60.58MB/s    0:00:22 (xfr#1, to-chk=0/1)

sent 43 bytes  received 1.40G bytes  52.88M bytes/sec
total size is 1.40G  speedup is 1.00

考察

  • 5倍近くの速度差が出た
  • 転送元サーバーでの圧縮がシングルコアで行われたためにCPU律速した
  • postgresqlのバイナリ形式のダンプはもともと圧縮されているので、rsyncでzをつけても圧縮できていない、つまり帯域節約の効果はない

感想

圧縮されてないクソデカログファイルとかならzはワンちゃんあるけどそうじゃないなら現代ではいらないかなぁ・・・

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?