Query counts all contacts but one?

I have a query that is repeated regularly and is pretty heavy on the database:

SELECT COUNT(id) AS count

FROM contacts

WHERE team_set_id = '1'

AND deleted = 0

AND id != '62f0e518-5d7e-8e98-f809-58d3bd75e98c'

 

The contact ID parameter changes, as does the team_set_id but otherwise it is fundamentally the same every time.

It just ran 68 times in the last hour and I can't think of what could possibly be doing this.

 

I know for a fact that it's not a Report or a List view. What else could it be?

Any thoughts? 

Thanks,
FrancescaS

  • It looks like it is run from 'modules/Teams/TeamSetManager.php' in the doesRecordWithTeamSetExist() function

  • Thank you Kenneth Brill, it looks like this was addressed in 7.9.x as there is an extra setMaxResults in that function:

            // set the maximum number of records to be 1 to avoid scanning extra records in database

            $query = $queryBuilder->setMaxResults(1)->getSQL();

     

    Hopefully we won't see this again in our query analytics after the upgrade to 7.9.3 this Friday.

     

    FrancescaS