Unusually high CPU usage

(not swap, but they’re reading from disk)

this fits with my earlier observations:

Note this is the size of the relation and indexes. Compare with pg_relation_size.

This is from ScoreCalculator, part of PeriodicalUpdates.

This is your finding that needs to be solved. By comparison, here on meta Jobs::EnsureDbConsistency takes <2min and Jobs::TopRefreshOlder takes <10s:

Postgres needs more memory. Give it as much as you can.

You might also see benefit from a VACUUM ANALYZE or VACUUM ANALYZE FULL. Doing the first never hurts.

I’d probably do, in order:

  • vacuum analyze
  • pause sidekiq then vacuum analyze full (this freezes the tables to rewrite them fully, may incur some failures while it runs)
  • more memory to postgres
1 Like