按天统计,获取每天UV相对前一天的增长情况

    1. * | select day ,uv, uv *1.0 /(lag(uv,1,0) over() ) as diff_percentage from
    2. (
    3. select approx_distinct(ClientIP) as uv, date_trunc('day',__time__) as day from log group by day order by day asc
    4. )

    image.png

    计算每小时的PV:

    1. * | SELECT count(1) as pv , date_trunc('hour',__time__) as hour group by hour order by hour limit 100
    2. * | SELECT count(1) as pv, __time__ - __time__% 300 as minute5 group by minute5 limit 100

    image.png