Insert/Update operations makes queries slow?

For future reference:

I narrowed the problem down to queries with aggregations.
The solution to my problem is mentioned here: