@Xon @Mouth thanks for starting a discussion about this. I decided to let admins choose the type of query to execute if they decide to not use total viewers per level 1 category/forum/page node on forum home.
Retrieving the totals only, is just a simple query using GROUP BY.
If admins decide to display x number of user names/avatars under each level 1 node on forum home (no pagination is required as the more link is set for an individual node id and will work like the followers overlay):
Option One:
UNION ALL does work well and guarantees there will be members to display per level 1 forum if there are any. It's just noticeably slower to execute, and can become quite large if there are a number of level 1 nodes on forum home. I use INNER JOIN for the user data, and that appears to be a little faster than LEFT JOIN.
Option Two:
Retrieve all user_ids, and node_ids they are viewing, and then loop through them to sort by node_id, and check the user counts, array_slice the number of users to the limit set by the admin (+ 1, for the more links) for each node_id, and then use another query to load in the user data. This way needs an additional query, but the total user records retrieved in the second query will be limited to number of level_1 nodes * the limit setting + 1. This option places the work load on PHP.
The way I stand on either choice is that of six of one, half dozen of the other, though the latter choice would likely be more efficient overall.