# Post.calculate\_avg\_time() taking up a long time

**URL:** <https://meta.discourse.org/t/post-calculate-avg-time-taking-up-a-long-time/49750>\
**Category:** Product Support\
**Created:** [5 september 2016 om 19:32 UTC](https://meta.discourse.org/t/post-calculate-avg-time-taking-up-a-long-time/49750 "2016-09-05T19:32:20Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![michaeld](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaeld/32/1594_2.png) [@michaeld](https://meta.discourse.org/u/michaeld)\
**Post date:** [5 september 2016 om 19:32 UTC](https://meta.discourse.org/t/post-calculate-avg-time-taking-up-a-long-time/49750/1 "2016-09-05T19:32:20Z")

</div>

On forums with a lot of posts, we see the daily `CalculateAvgTime` job taking up a lot of time and even block other processes.

The source code comments already say

```
# PERF: these calculations can become exceedingly expnsive
# they run a huge gemoetric mean and are hard to optimise
# defer to only run once a day

```

But they still don’t play nice.  
Would it hurt if we clean up the `post_timings` table on a regular basis? Or are we missing something obvious here and is there a better way to solve this?

---

_[View the full topic](https://meta.discourse.org/t/post-calculate-avg-time-taking-up-a-long-time/49750)._
