How many passes of a table are done with UNION ALL?
Each query in UNION ALL is executed separately, union only "merges" the result sets so if each query needs to read entire table, it will be done twice. You can check that with EXPLAIN in MySQL or similar commands in other RDBMS.

One usage for UNION (ALL) is actually optimizing queries with OR conditions, where separate queries can use indexes better than one "bigger" query.

In your case it seems you might still do it with only one query. Just quessing here from what you wrote but did you consider using

SELECT count(col) AS totalCount, count(distinct col) AS uniqueCount FROM ...


?

Or WITH ROLLUP modiffier for GROUP BY? (It is MySQL - other RDBMS will probably have something similar)