Commit 21a56ea
optimizing reporting_patient_states partitioned refresh (#5700)
**Story card:**
[sc-16750](https://app.shortcut.com/simpledotorg/story/16750/make-partitioned-refresh-performant)
## Because
In India partitioned refresh was running for 2 weeks, which is not
acceptable.
## This addresses
Adding a month_date index on reporting_prescriptions to make the join,
which provides "titrated" column, faster.
Using an indexed field, month_date, for joins in
reporting_patient_blood_sugars, reporting_patient_blood_pressures and
reporting_patient_visits to improve the overall performance.
## Test instructions
Run `rake "db:refresh_reporting_views"`
For small dataset, this optimization is not measurable.
We tested this in India prod, after these optimizations, refresh was
completed in 15 mins.
---------
Co-authored-by: Ayushi Agrawal <[email protected]>1 parent cd2124f commit 21a56ea
File tree
3 files changed
+447
-6
lines changed- db
- migrate
3 files changed
+447
-6
lines changedLines changed: 13 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
0 commit comments