-- 获取最新的数据
select max(timestamp)
from activities;

-- 1天内的数据，按action分组排序
select b.action_id, b.action, count(b.action_id)
from activities as a
         left join actions as b on a.action_id = b.action_id
where timestamp > EXTRACT(EPOCH FROM current_timestamp(0))::bigint - 86400
group by b.action_id, b.action
order by count(b.action_id) desc;
