No, this is the right way to do this in your case. Your calculations are likely to always be 0 or 1 and will be satisfied from the NC index.
If you want to scan more data, this may be more efficient for this:
select sum(case when user = 'x' then 1 end) UserCount, sum(case when email = 'x' then 1 end) EmailCount
from users
This will always check the table. It depends on data whose speed is higher. In your case, yours is faster.
source
share