lazy_columns icon indicating copy to clipboard operation
lazy_columns copied to clipboard

Reduces speed when used in an includes

Open hlogmans opened this issue 11 years ago • 4 comments

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)

hlogmans avatar Mar 12 '13 09:03 hlogmans

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.

jorgemanrubia avatar Mar 13 '13 07:03 jorgemanrubia

I believe this is a bug with default_scope combined with includes in Rails: https://github.com/rails/rails/issues/785

GUI avatar Apr 12 '13 02:04 GUI

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.

jorgemanrubia avatar Apr 12 '13 08:04 jorgemanrubia

Fixed in Rails 5.0 (https://github.com/rails/rails/pull/21033). Will try to either resurrect (https://github.com/rails/rails/issues/785) or backport stuff from 5.0 to 4.2/3.2

aleksandrs-ledovskis avatar Jan 04 '16 20:01 aleksandrs-ledovskis