-
Notifications
You must be signed in to change notification settings - Fork 50
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
Enhence performance when querying root model of subclasses #65
Comments
From by brief research I believe its common for STI libraries to behave like this. a) I'd be curious to see numbers of the relative performance of the queries I don't have time to dig in to the implementation details of this but a PR would always be considered. |
@jonspalmer Thanks for the reply. a) When it comes to about 10000 records, it matters. I brought evidence from laravel repo. b) yes, i agree to your opinion. I will create PR for this issue soon :) |
@darron1217 thanks for the details but those are not good examples of the problem. a) The first query is only selecting one column from the table which will typically be faster than selecting "*" as there is less data to for the DB to collect and send over the wire We think we need real examples of the problem at hand with sql "EXPLAIN" details of the queries. |
@jonspalmer I'll test with |
@jonspalmer Let's close this issue :) |
I found that if model has subclasses, trait adds
whereIn
condition to query.But the root model (which queries every type) don't need
whereIn
condition to select specific types. It will just make query slow.I think it would be nice to remove
whereIn
condition when querying root model.The text was updated successfully, but these errors were encountered: