rackerlabs/stacktach — pull request #238 by ramielrowe (2013-10-30 17:59:21+00:00)
Title: Remove select_related() from details/search/latest_raw 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.