lazy_columns
lazy_columns copied to clipboard
Reduces speed when used in an includes
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)
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.
I believe this is a bug with default_scope
combined with includes
in Rails: https://github.com/rails/rails/issues/785
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.
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