rackerlabs/stacktach — pull request #237 by ramielrowe (2013-10-30 17:00:18+00:00)
Title: Removing the select_related() from details/search calls

The join caused by select_related() can cause mysql to make poor
choices in regards to index selection. It appears that in small to
mid sized deployments, searches on RawData when joined to
Deployment will use the index on the column being searched instead
of the 'when' that ultimately orders the data. This causes mysql
to create a temp table and file sort that table, which is quite
ineffecient.

This fix simply removes the select_related() calls and populates
the deployment field on the raws by hand.