Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize Patient Summaries MatView (#5515)
**Story card:** [sc-13796](https://app.shortcut.com/simpledotorg/story/13796/patient-line-list-returning-no-data-in-simple-dashboard-ethiopia) ## Because We need a more efficient matview query which works across countries and scales as Simple is used. Currently, the v03 fails in Ethiopia, causing the line list to return an empty zip. V04 uses some advanced SQL to optimize the query, and ensure it scales regardless of how much the underlying data grows ## This addresses - do away with lateral joins (joining the same set over and over) - filter early - do away with the non-performant `select *` - leverage `lead()` and `lag()` to reduce joins ## Test instructions See ticket for the run link
- Loading branch information