ORDER BY (排序)可类似简单索引使用,mongodb中的索引就是用排序来建立的。order by只能减少,不能新增。即建表时已固定。如果使用主键, 主键必须在order by 第一位;order by 的列必须非空。
TTL expr [DELETE|TO DISK ‘aaa’|TO VOLUME ‘bbb’], … clickhouse支持数据超时设计,但是目前没有想到合适场景。
select t1.date "日期",t1.channelCode "渠道",t2.c1 "阅读页UV",t1.c1 "阅读页顶部返回按钮点击",t1.c2 "阅读页顶部关闭按钮点击",t1.c3 "阅读页阅读记录按钮点击",t1.c4 "阅读页返回首页按钮点击",t2.c2 "个人中心页面",t1.c5 "我的顶部退出按钮点击",t2.c3 "书城uv",t1.c6 "书城顶部退出按钮点击" from ( select date ,channelCode,sum(r[2]) c1,sum(r[3]) c2,sum(r[4]) c3,sum(r[5]) c4,sum(r[6]) c5,sum(r[7]) c6 from (select date,channelCode,deviceNo ,retention(1,buttonCode = 'BUTTON_READ_RETURN' , buttonCode = 'BUTTON_READ_QUIT',buttonCode = 'BUTTON_READ_RECORD',buttonCode = 'BUTTON_RETURN_HOME',buttonCode = 'BUTTON_MY_QUIT',buttonCode = 'BUTTON_BOOK_QUIT') rfrom count_button_logwhere date BETWEEN 20201118 and 20201122and buttonCode in ('BUTTON_READ_RETURN','BUTTON_READ_QUIT','BUTTON_READ_RECORD','BUTTON_RETURN_HOME','BUTTON_MY_QUIT','BUTTON_BOOK_QUIT')and behavior = 'click'and channelCode = 'yoc_lwxs_KH-10' -- and channelCode in ('yoc_lwxs_LWXS-3','yoc_lwxs_SJLR-1NEW','yoc_lwxs_ZY-17','yoc_lwxs_ZY-29','yoc_lwxs_DTYT-5','yoc_lwxs_SJLR-7','yoc_lwxs_KH-10','yoc_lwxs_YL-7','yoc_lwxs_KH-18','yoc_lwxs_KH-6','yoc_lwxs_YL-10NEW')group by date,channelCode,deviceNo) group by date,channelCode ) t1left join ( select date,channelCode,sum(r[2]) c1,sum(r[3]) c2,sum(r[4]) c3 from(select date,channelCode,deviceNo,retention(1,page = '40001' , page = '40005',page = '40003') rfrom count_page_log cpl where page in( '40001','40005','40003')and date BETWEEN 20201118 and 20201122and channelCode = 'yoc_lwxs_KH-10' -- and channelCode in ('yoc_lwxs_LWXS-3','yoc_lwxs_SJLR-1NEW','yoc_lwxs_ZY-17','yoc_lwxs_ZY-29','yoc_lwxs_DTYT-5','yoc_lwxs_SJLR-7','yoc_lwxs_KH-10','yoc_lwxs_YL-7','yoc_lwxs_KH-18','yoc_lwxs_KH-6','yoc_lwxs_YL-10NEW')group by date,channelCode,deviceNo) group by date,channelCode ) t2 on t1.date = t2.date and t1.channelCode = t2.channelCode order by t1.date