Currently on partner dashboard we should counts of replies sent by that partner's users. These are calculated on the fly, and that works for our production instance because total number of replies is still < 100,000.
With upcoming org-level dashboard and as database grows, need to add proper tracking of these counts. We can track on a per-day basis and aggregate to generate per-month charts.
From our experience with RapidPro, the most reliable way to track counts and avoid database deadlocks is to use an insert/squash pattern. As new items are created, they insert a count into a table, and a background process is responsible for squashing those into daily totals.
Currently on partner dashboard we should counts of replies sent by that partner's users. These are calculated on the fly, and that works for our production instance because total number of replies is still < 100,000.
With upcoming org-level dashboard and as database grows, need to add proper tracking of these counts. We can track on a per-day basis and aggregate to generate per-month charts.
From our experience with RapidPro, the most reliable way to track counts and avoid database deadlocks is to use an insert/squash pattern. As new items are created, they insert a count into a table, and a background process is responsible for squashing those into daily totals.