Cassandra创建视图

         1.视图是虚拟的表,cassandra创建视图可以优化查询语句,否则要使用allow filtering 全表查询,这样性能很低
创建视图:
create materialized view message_log_view as 
select * from message where trancation_type is not null and msg_time is not null and business_type is not null and id is not null
primary key (trancation_type,msg_time,business_type,id)
         2.使用视图查询:
select * from message_log_view where trancation_type in ('T1000167','C002_001','C004_001') and msg_time>'16039358200000';
         3.删除视图:
drop  materialized view message_log_view_b;

猜你喜欢

转载自blog.csdn.net/weixin_43697214/article/details/109380123
今日推荐