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

Reports query optimization using index hints #103

Merged

Conversation

VitaliStupin
Copy link
Contributor

@VitaliStupin VitaliStupin commented Nov 9, 2023

MongoDB sometimes selects incorrect index during report preparation queries. This results in inconsistent performance when some of the queries are unnecessarily slow. Using index hints helps MongoDB to select appropriate indexes for the queries.

This problem became especially obvious after upgrade to MongoDB v7, but the problem existed before upgrade too.

Additionally removing unnecessary DB requests to find the list of documents where client and service is the same subsystem.

Copy link

sonarqubecloud bot commented Nov 9, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link

Quality Gate Passed Quality Gate passed

Issues
1 New issue

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

* MongoDB sometimes selects incorrect index for query
* Hint helps to avoid unnecessarily slow queries
As X-Road usually has more service clients than producers, using client subsystem code based index returns fewer rows and performs better
Avoiding unnecessary DB requests to find the list of documents where client and service is the same subsystem. This info is computable from document data.
Additionally, fixing invalid duplicate detection when client and producer requestInTs are in different report periods. "get_faulty_documents" did not find duplicates in that case.
@melbeltagy melbeltagy force-pushed the reports-index-hints branch from 60c8663 to 84996fa Compare June 3, 2024 18:53
Copy link

sonarqubecloud bot commented Jun 3, 2024

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
2.6% Duplication on New Code

See analysis details on SonarCloud

@melbeltagy melbeltagy merged commit a990d90 into nordic-institute:develop Jun 3, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants