Optimize communities

This creates a DB index and modifies a few views and queries, in the hope of speeding things up a bit.