Increase in CPU usage of database after update to orthanc 1.12.7

Hi Alain,

I’m Vicente’s colleague. We identified the root cause of the problem as a large accumulation of InvalidChildCounts entries that needed to be deleted in cascade. After adding an index on InvalidChildCounts(id), the issue was resolved.

We also observed a similar pattern with GlobalIntegersChanges during the execution of UpdateStatistics. When this function isn’t run periodically, the accumulated entries can grow to a point where the first execution causes the database to crash due to resource exhaustion.

Based on our experience, I would recommend the following improvements for future versions:

  1. Add an index on InvalidChildCounts(id) to speed up deletions.
  2. Introduce a LIMIT in the DELETE query within UpdateSingleStatistic to process GlobalIntegersChanges in smaller, manageable batches.

For context, in our case:

  • UpdateStatistics took around 12 hours before we had to manually terminate it to free up database CPU.
  • DeleteResource was taking between 3 and 15 minutes per execution.

After applying the above optimizations, both operations now complete in just a few seconds.

Best regards,
Rafik

1 Like