A group is a (localUid, remoteUid) pair. It should be the same as a `GROUP BY localUid, remoteUid` for all sane databases - but it's much faster, because it can group on indexed integers instead of strings.

The UNION ALL then adds all of the events that don't have an associated group - mainly, phone calls.