Skip to content

Conversation

@erikkessler1
Copy link

This PR fixes the bug described in #143.

The subquery returns 1 row so there is no need to use "IN" as the "=" operator will work just fine. Additionally, using "=" doesn't allow the query planner to choose a plan that can sidestep the LIMIT.

The subquery should only return a single row so there is no need to
use IN. Using "=" avoids a situation where the planner can sidestep
the LIMIT in the subquery.
@stephanvd
Copy link

We're having the same problem using postgres 11.

SaitoJP added a commit to SaitoJP/delayed_job_active_record that referenced this pull request Jul 8, 2020
The subquery should only return a single row so there is no need to
use IN. Using "=" avoids a situation where the planner can sidestep
the LIMIT in the subquery.
collectiveidea#169
sauy7 added a commit to fishbrain/delayed_job_active_record that referenced this pull request Sep 11, 2021
albanpeignier added a commit to enroute-mobi/chouette-core that referenced this pull request Oct 11, 2022
@rubyonrailsworks
Copy link

Having same issue and this merge request will resolve it, why don't we merge it in to master branch?

@mantas
Copy link

mantas commented May 9, 2025

Thank you for this PR! I was trying to pin down this issue for a long time... It's a pity it's not merged yet.

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.

4 participants