How do I get the total users that match a particular query?

This is tough to answer because it depends on the user base.

For example, with few users you could likely do it hourly with no issues, but the bigger question is should you do it. If you have a large user base that needs to be queried against in that fashion of an hourly basis there might be a better method on how to proceed forward.

However if it’s infrequently done, it shouldn’t be a problem in any case.

All of this can depends on a varying slide of data/users vs frequency. If you have more exact specifications you would like me to check on, please let me know. Thanks!