Introducing AGGREGATED_PRESENCE - thanks to JSharkey for the idea.

This new DB table is maintained in memory and summarizes the presence
status and custom status for each (aggregate) contact.  With the help
of this table, we avoid having to do GROUP BY and MAX(status) when
running contacts summary queries. An added benefit is that
we can now get the latest custom status update as part of the
summary query.
5 files changed