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

[Issue #1835] Remove distinct from inner query of search #1836

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

chouinar
Copy link
Collaborator

Summary

Fixes #1835

Time to review: 3 mins

Changes proposed

Adjust the search query to not do distinct on the inner filter query

Context for reviewers

This distinct originally was added as the query was setup in a much different way. We needed to do the distinct to avoid duplicates when doing joins, but because it is now an inner query - quite literally used as select ... where opportunity_id in (select distinct opportunity_id ...) we don't need to distinct it. If the values aren't distinct, it doesn't actually change the outer query, there will just be dupes in that list, but that's fine and seems to be better performing.

Copy link
Collaborator

@coilysiren coilysiren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤞🏼

@chouinar chouinar merged commit 960cdd6 into main Apr 25, 2024
8 checks passed
@chouinar chouinar deleted the chouinar/db-perf-distinct-remove branch April 25, 2024 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task]: Remove distinct from inner query of search
2 participants