I thought this would be really complicated, but turns out there’s a handy “participant_count” column in the database ![]()
Top topics by number of unique participants over the last year
-- [params]
-- string :interval = 1 year
SELECT id as topic_id, participant_count
FROM topics
WHERE bumped_at >= CURRENT_DATE - INTERVAL :interval
ORDER BY participant_count DESC
Average number of unique participants over the last year
-- [params]
-- string :interval = 1 year
SELECT avg(participant_count)
FROM topics
WHERE bumped_at >= CURRENT_DATE - INTERVAL :interval