-
-
Notifications
You must be signed in to change notification settings - Fork 955
Fix reverse dependencies by using distinct #5566
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
base: master
Are you sure you want to change the base?
Fix reverse dependencies by using distinct #5566
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #5566 +/- ##
===========================================
+ Coverage 71.71% 94.35% +22.63%
===========================================
Files 453 453
Lines 9609 9470 -139
===========================================
+ Hits 6891 8935 +2044
+ Misses 2718 535 -2183 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
I'm a bit concerned if this will have a performance impact, can you share the generated queries and I can explain analyze them? |
I'll check. |
a1c473f
to
d7c46a8
Compare
SELECT rubygems.*
FROM rubygems
JOIN versions
ON rubygems.id = versions.rubygem_id
JOIN dependencies
ON versions.id = dependencies.version_id
JOIN gem_downloads
ON gem_downloads.version_id = 0
AND gem_downloads.rubygem_id = rubygems.id
WHERE dependencies.rubygem_id = {the_ruby_gem_id}
AND versions.indexed = TRUE
AND versions.position = 0
ORDER BY gem_downloads.count DESC; After SELECT DISTINCT rubygems.*, gem_downloads.count
FROM rubygems
JOIN versions
ON rubygems.id = versions.rubygem_id
JOIN dependencies
ON versions.id = dependencies.version_id
JOIN gem_downloads
ON gem_downloads.version_id = 0
AND gem_downloads.rubygem_id = rubygems.id
WHERE dependencies.rubygem_id = {the_ruby_gem_id}
AND versions.indexed = TRUE
AND versions.position = 0
ORDER BY gem_downloads.count DESC; |
@simi @segiddins, let me know what you think. |
Fix reverse dependencies bug
Another example: https://rubygems.org/gems/rspec/reverse_dependencies
Description
Reverse dependencies are being repeated.
Linked issue: #5199
Tried to solve this at least in the user facing controller side of things.