ystemd+ 7660 0.0 0.3 352060 28284 ? S 22:31 0:00 /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main
systemd+ 7667 0.0 0.1 352588 9628 ? Ss 22:31 0:00 postgres: 13/main: checkpointer
systemd+ 7668 0.3 0.9 352060 78796 ? Ss 22:31 0:03 postgres: 13/main: background writer
systemd+ 7669 0.0 0.1 352060 13696 ? Ss 22:31 0:00 postgres: 13/main: walwriter
systemd+ 7670 0.0 0.1 352728 11892 ? Ss 22:31 0:00 postgres: 13/main: autovacuum launcher
systemd+ 7671 0.0 0.0 67996 5320 ? Ss 22:31 0:00 postgres: 13/main: stats collector
systemd+ 7672 0.0 0.0 352612 6640 ? Ss 22:31 0:00 postgres: 13/main: logical replication launcher
systemd+ 10900 82.0 3.8 487164 317728 ? Rs 22:33 10:42 postgres: 13/main: discourse discourse [local] DELETE
systemd+ 10901 0.0 0.1 353432 13804 ? Ss 22:33 0:00 postgres: 13/main: discourse discourse [local] idle
htop によると、CPU を 100% 消費しているのは discourse [local] delete です。ドロップレットは 8GB の RAM を搭載しており、現在使用されているのは 1GB 未満です(バッファは除く)。
OS は最新ではありませんが、これは非常に奇妙に思えます。RAM もディスクも十分あり、その postgres delete タスクは 12 分以上実行されています。投稿は 60 万未満、ユーザーは 4 千未満なので、データベースはそれほど大きくありません。ああ、待ってください。postgres_data ディレクトリは 28GB です。
VACUUM VERBOSE ANALYZE; を実行しました。
これを実行しました:
discourse=# SELECT checkpoints_timed, checkpoints_req FROM pg_stat_bgwriter;
checkpoints_timed | checkpoints_req
-------------------+-----------------
6 | 20
現在、同時にインデックスを再構築しようとしています。バキュームとインデックスの再構築が役立つかもしれません。