-
-
Notifications
You must be signed in to change notification settings - Fork 256
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
fix: associations query limit on select options #3418
base: main
Are you sure you want to change the base?
fix: associations query limit on select options #3418
Conversation
ef95dc6
to
3cd8add
Compare
Code Climate has analyzed commit bba4886 and detected 0 issues on this pull request. View more on Code Climate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The query.all.count
will perform sub-optimal on large datasets
From this stackoverflow thread:
I just ran into a situation where a table of 1.3 million rows was taking about 35 seconds to perform a simple SELECT COUNT(*).
For our table with 20M records, it took 4 minutes.
Instead, I suggest fetching records with the defined limit, then checking the size of the retrieved dataset. If the result size matches the limit, two scenarios are likely:
- There are more records beyond the limit (most probable).
- The limit precisely matches the total record count (less less less probable).
Let's discuss the option name and the default limit.
Otherwise this PR looks good! Thank you @thiagoyoussef
5b21720
to
f989d91
Compare
Description
Fixes #2406
Checklist:
Screenshots & recording
On attach model:
On edit belongs to: