code-dot-org/code-dot-org — pull request #219 by laurelfan (2014-10-20 19:00:01+00:00)
Title: ideal_level_source (ie. solution) calculation 

This time try taking advantage of existing indexes rather than creating a new one.

We do not have an index on `activities.level_id`, but we do have indexes on `level_source_id.level_id` and `activities.level_source_id` so if we join and count on those columns instead we should be able to avoid a full table scan of activities.