Closed LZRS closed 2 weeks ago
@aditya-07 @MJ1998 here's the ticket about the issue on performance we're experiencing
Can you tell me how does it perform without filter of active Patients ?
One improvement I can think of is removing a.resourceType = b.resourceType
clause in JOIN statement as we are filtering resourceType using WHERE clause.
But not sure if this is feasible or even if it's gonna improve the performance
It is worth noting that the above latency difference is observable even on non-device sqlite db browsers like SQLiteStudio.
Can you tell me how does it perform without filter of active Patients ?
Removing the subquery that performs this filter has no impact on the performance.
One improvement I can think of is removing
a.resourceType = b.resourceType
clause in JOIN statement as we are filtering resourceType using WHERE clause. But not sure if this is feasible or even if it's gonna improve the performance
Removing this does improve the performance as well, executing the query in milliseconds cc LZRS
thank you very much for catching this @LZRS! very happy for the improvement in @MJ1998 's pr.
just one comment for clarification and potential future work: https://github.com/google/android-fhir/pull/2553#issuecomment-2142169138
Describe the bug When loading around 7k patients ordered by Patient.Name, the db query takes around 25s Without sorting the query takes around 35ms
This is when using
that generates SQL query
Tested out that removing the
ORDER BY b.index_value ASC
reduces the latency of the query to millisecondsExpected behavior The usecase of loading resources with sort should be more performant
Additional context Here's a link to the resources db containing around 7k patients, that can be used for testing https://drive.google.com/file/d/1TgPw36BFI8BijsUPc1JkQE3l3RXANYzT/view?usp=drive_link
Would you like to work on the issue? Please state if this issue should be assigned to you or who you think could help to solve this issue.