Replace potentially expensive COUNT with EXISTS.
Replace potentially expensive COUNT with EXISTS.

Test Plan: Unit tests; run events sync.

Reviewers: ethanb

Reviewed By: ethanb

Differential Revision: https://phab.nylas.com/D2519

nylas/sync-engine,jobscore/sync-engine,closeio/nylas,closeio/nylas,closeio/nylas,jobscore/sync-engine,nylas/sync-engine,nylas/sync-engine,jobscore/sync-engine,closeio/nylas,nylas/sync-engine,jobscore/sync-engine