Should I schedule stats computation in a queue instead of holding the response?

Viewed 13

I am computing a lot of stats in the backend, when one record changes,

At least 7-10 queries ran depending on what type of record changes. All of those queries are aggregating data and some of them span over the whole collection.

So I was thinking instead of computing them and holding the request's response. I should send the response and schedule a job that will compute those stats in workers.

What do you think of this solution? Is it a good approach or bad? I am looking for an optimal solution for this.

0 Answers
Related