CRM-15107 - Fix slow group_contact count query on large dbs