theforeman/foreman — pull request #1878 by eLobato (2014-10-23 09:57:04+00:00)
Title: Fixes #8048: n+1 query selecting multiple hosts

Sample data for 200 hosts selected, organizations and locations enabled.

* Click on change environments takes ~9-10s to load on my hardware without eager loading
* With the patch it's reduced to ~3-4s (around a 66% speedup for the query)