unread icon indicating copy to clipboard operation
unread copied to clipboard

`cleanup_read_marks` killing database CPU for hours?

Open Nealsoni00 opened this issue 2 years ago • 1 comments

Hey all!

I'm getting a weird issue when I run cleanup_read_marks on all readable tables, it takes ~10 hours to run to completion and takes up 90% of the DB CPU time.

Would love any information on how the cleanup works and how to make it faster!

Thanks in advance!

Nealsoni00 avatar Jul 25 '23 12:07 Nealsoni00

Things that I can think of as causes:

  • Missing database indices
  • First cleanup after years without cleanup
  • Your database is so large that this gem is not the right solution

Look here for the internals of the cleanup: https://github.com/ledermann/unread/blob/master/lib/unread/garbage_collector.rb

ledermann avatar Jul 25 '23 13:07 ledermann