theforeman/foreman — pull request #992 by xorpaul (2013-10-30 13:52:50+00:00)
Title: Return unsorted facts to improve performance

With around 150k facts and 7k hosts clicking the fact tab in the foreman GUI takes around 4-6 seconds.

https://gist.github.com/xorpaul/7232272

@ohadlevy suggested this patch to cut the time for the first SQL query down to a few milliseconds.

If this shouldn't be the default, maybe a config parameter or a smart switch (if the number of facts is above $THRESHOLD) should be possible.