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

Reduces speed when used in an includes #1

Open
hlogmans opened this issue Mar 12, 2013 · 4 comments
Open

Reduces speed when used in an includes #1

hlogmans opened this issue Mar 12, 2013 · 4 comments

Comments

@hlogmans
Copy link

If I do something like 'Articles.includes(:contentitems)', where contentitems has lazy loaded columns, the resulting query is like: 'select contentitems.[nonlazy columns], contentitems.* from contentitems', which of course even further degrades performance. I looked at the source if I could alter its behaviour, but I don't understand enough how these includes pull their columns...

(I tested two other gems doing something alike and those work neither)

@jorgemanrubia
Copy link
Owner

Hi @hlogmans,

Thanks for reporting this issue. I will look into it. I am not sure I can fix it with the current approach but this is something that should be fixed anyway.

@GUI
Copy link

GUI commented Apr 12, 2013

I believe this is a bug with default_scope combined with includes in Rails: rails/rails#785

@jorgemanrubia
Copy link
Owner

Indeed @GUI. Thanks a lot for the info. I'm glad that at least it is tracked. I will try to see how to fix that in Rails. There seem to be an old patch that was never included in Rails.

@aleksandrs-ledovskis
Copy link

Fixed in Rails 5.0 (rails/rails#21033). Will try to either resurrect (rails/rails#785) or backport stuff from 5.0 to 4.2/3.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants