nemomobile/libcommhistory — pull request #59 by special (2013-11-19 06:28:05+00:00)
Title: Optimize group query SQL

This series of changes:

1. Adds an upgrade path for databases, and changes some indexes on the Events table
2. Removes the 'totalMessages' and 'sentMessages' fields of Group entirely, including all relevant API. These seem to have no uses outside of libcommhistory itself, and are expensive to query for every group unconditionally
3. Tweaks the group query to avoid braindead choices by SQLite's query planner

For GroupModel::getGroups with 160 groups and 120k events, this reduces query time from 7500ms to <1ms.