Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[P2P] Possible p2p sync slow regression #2536

Closed
ekigamba opened this issue Jul 6, 2023 · 0 comments · Fixed by #2562
Closed

[P2P] Possible p2p sync slow regression #2536

ekigamba opened this issue Jul 6, 2023 · 0 comments · Fixed by #2562
Assignees
Labels
Bug Report Something isn't working as expected P2P Sync

Comments

@ekigamba
Copy link
Contributor

ekigamba commented Jul 6, 2023

Describe the Issue

The updates on Android FHIR SDK made here delete an index that was added in this PR. The purpose of the index is to speed up p2p sync

We need to manually test this out on any SQLite browser with the latest DB containing these changes to confirm if the new index resolves this issue or we will need to add the index_from index.

The query used in p2p that is affected is

SELECT a.serializedResource
FROM ResourceEntity a
LEFT JOIN DateIndexEntity b
ON a.resourceType = b.resourceType AND a.resourceUuid = b.resourceUuid 
LEFT JOIN DateTimeIndexEntity c
ON a.resourceType = c.resourceType AND a.resourceUuid = c.resourceUuid
WHERE a.resourceUuid IN (
SELECT resourceUuid FROM DateTimeIndexEntity
WHERE resourceType = 'Task' AND index_name = '_lastUpdated' AND index_to >= '0'
)
AND (b.index_name = '_lastUpdated' OR c.index_name = '_lastUpdated')
ORDER BY b.index_from ASC, c.index_from ASC, a.id ASC
LIMIT 25 OFFSET 0

More details about the issue can be found here. The latest DB changes are available on v0.2.4-opensrp or possibly on main

@dubdabasoduba dubdabasoduba added P2P Sync Bug Report Something isn't working as expected labels Jul 6, 2023
@pld pld added this to the Sprint 14 (4th July - 17th July) milestone Jul 6, 2023
ekigamba added a commit that referenced this issue Jul 7, 2023
ekigamba added a commit that referenced this issue Jul 7, 2023
ndegwamartin pushed a commit that referenced this issue Jul 7, 2023
Fixes #2536

Co-authored-by: Benjamin Mwalimu <dubdabasoduba@gmail.com>
ekigamba added a commit that referenced this issue Jul 10, 2023
Fixes #2536

Co-authored-by: Benjamin Mwalimu <dubdabasoduba@gmail.com>
@pld pld closed this as completed in #2562 Jul 10, 2023
pld added a commit that referenced this issue Jul 10, 2023
* Change p2p fetch records query to fix slowness (#2554)

Fixes #2536

Co-authored-by: Benjamin Mwalimu <dubdabasoduba@gmail.com>

* update test

---------

Co-authored-by: Benjamin Mwalimu <dubdabasoduba@gmail.com>
Co-authored-by: pld <peter@ona.io>
qiarie pushed a commit that referenced this issue Jan 15, 2025
* Change p2p fetch records query to fix slowness (#2554)

Fixes #2536

Co-authored-by: Benjamin Mwalimu <dubdabasoduba@gmail.com>

* update test

---------

Co-authored-by: Benjamin Mwalimu <dubdabasoduba@gmail.com>
Co-authored-by: pld <peter@ona.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Report Something isn't working as expected P2P Sync
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants