Monthly active users (SQL)

demo SQL never expires 10 views 272 B 9 lines
Raw Download
select date_trunc('month', created_at) as month,
       count(distinct user_id)        as active_users,
       count(*)                       as total_pastes
from pastes
where created_at >= now() - interval '6 months'
  and user_id is not null
group by 1
order by 1 desc;