Fix repeated column lookups in 3.0.5+ (eager loaded has_one association with conditions) #246

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@baconpat

The following issue affects the 3-0-stable branch:

https://rails.lighthouseapp.com/projects/8994/tickets/6599-305-introduced-repeated-column-lookups-for-eager-loaded-has_one-with-conditions

The AssociationProxy code appears to have been completely rewritten on master so I am not sure if this is a problem there or not (I am also not able to run my app against master right now to test it). But in the meantime I am asking that this patch get pulled into 3.0 stable to improve the situation for the 3.0.x line.

Even with this patch applied I am still seeing slower performance with (patched) 3.0.5+ vs 3.0.4, but it is much improved (3 - 4 times faster for a page loading many rows).

Added back the use of the Reflection module's cached sanitized_condit…
…ions in an AssociationProxy. This was recently removed and when a has_one association with conditions is eager loaded the conditions would be sanitized once for every result row, causing a database hit to fetch the columns.
@tenderlove

This comment has been minimized.

Show comment
Hide comment
@tenderlove

tenderlove Mar 30, 2011

Member

Merged. This seems like a bad regression, so I'm putting it in the 3.0.6.rc2. Thank you.

Member

tenderlove commented Mar 30, 2011

Merged. This seems like a bad regression, so I'm putting it in the 3.0.6.rc2. Thank you.

@tenderlove tenderlove closed this Mar 30, 2011

matthewd pushed a commit that referenced this pull request Apr 24, 2018

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