# Increase in CPU usage of database after update to orthanc 1.12.7

**URL:** https://discourse.orthanc-server.org/t/increase-in-cpu-usage-of-database-after-update-to-orthanc-1-12-7/6057
**Category:** General
**Created:** [July 21, 2025, 6:21pm UTC](https://discourse.orthanc-server.org/t/increase-in-cpu-usage-of-database-after-update-to-orthanc-1-12-7/6057 "2025-07-21T18:21:39Z")
**Posts on this page:** 1
**Showing post:** 6

<div class="post-metadata">

### Author: ![rmasad](https://discourse.orthanc-server.org/user_avatar/discourse.orthanc-server.org/rmasad/32/1727_2.png) [@rmasad](https://discourse.orthanc-server.org/u/rmasad)
#### Post date: [July 29, 2025, 10:53pm UTC](https://discourse.orthanc-server.org/t/increase-in-cpu-usage-of-database-after-update-to-orthanc-1-12-7/6057/6 "2025-07-29T22:53:03Z")

</div>

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

---

_[View the full topic](https://discourse.orthanc-server.org/t/increase-in-cpu-usage-of-database-after-update-to-orthanc-1-12-7/6057)._
