按天统计,获取每天UV相对前一天的增长情况
* | select day ,uv, uv *1.0 /(lag(uv,1,0) over() ) as diff_percentage from
(
select approx_distinct(ClientIP) as uv, date_trunc('day',__time__) as day from log group by day order by day asc
)
计算每小时的PV:
* | SELECT count(1) as pv , date_trunc('hour',__time__) as hour group by hour order by hour limit 100
* | SELECT count(1) as pv, __time__ - __time__% 300 as minute5 group by minute5 limit 100